Repository navigation
feat: support Temporal.Instant and Temporal.ZonedDateTime in vi.setSystemTime() - #11321
Conversation
ref vitest-dev#8107 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The two failing e2e jobs don't look related to this change. The same
The macOS |
Co-authored-by: Codex (GPT-6) <[email protected]>
Co-authored-by: Codex (GPT-6) <[email protected]>
Co-authored-by: Codex (GPT-6) <[email protected]>
Co-authored-by: Codex (GPT-6) <[email protected]>
Co-authored-by: Codex (GPT-6) <[email protected]>
Co-authored-by: Codex (GPT-6) <[email protected]>
Co-authored-by: Codex (GPT-6) <[email protected]>
setSystemTime()
Co-authored-by: Codex (GPT-6) <[email protected]>
Co-authored-by: Codex (GPT-6) <[email protected]>
Co-authored-by: Codex (GPT-6) <[email protected]>
setSystemTime()Temporal.Instant and Temporal.ZonedDateTime in setSystemTime()
Temporal.Instant and Temporal.ZonedDateTime in setSystemTime()Temporal.Instant and Temporal.ZonedDateTime in vi.setSystemTime()
Co-authored-by: Codex (GPT-6) <[email protected]>
|
Hello @Prajwal2246. Thank you for taking the time to contribute! Unfortunately, the team accepts pull requests only from maintainers and approved contributors, so this pull request was closed automatically. We are sorry about that, it is not a judgement of your work. The number of pull requests grew beyond what the team can review, and this policy gives maintainers the space to triage and prioritize issues at their own pace. Please keep the discussion in #8107. Your changes are not lost: a maintainer can reopen this pull request if the team decides to go forward with it. See our pull request policy for more context. |
|
Hi @hi-ogawa, the latest CI run is green. Could you take another look when you have a chance? Thanks! |
Updated description by @hi-ogawa
Temporalsupport to functions that acceptDate#8107This PR adds support for
setSystemTime(Temporal.Instant | Temporal.ZonedDateTime)by following Sinon’s structuraltype TemporalTimelike = { epochMilliseconds: number }shape to avoid requiring built-in Temporal types. The documented use cases are still onlyInstantandZonedDateTime.vi.useFakeTimers({ now })already supported them through Sinon, so this PR adds tests and documents that existing behavior.Original description
vi.setSystemTime()throws for aTemporal.Instantbecausenew Date(now)invokes Temporal's throwingvalueOf.This PR accepts
Temporal.InstantandTemporal.ZonedDateTimeinvi.setSystemTime()andvi.useFakeTimers({ now })(ref #8107).setSystemTime()converts them withepochMilliseconds; fake-timers already accepts them fornow.The public types resolve Temporal constructors from
globalThisand fall back toneverwhen Temporal types are absent. AZonedDateTimesets the instant, not the system time zone.Checks
packages/vitestbuilds.CDPSession.senderrors in the untouchedsrc/node/pools/browser.ts.Disclosure per CONTRIBUTING.md: Claude assisted with the original change, and Codex assisted with this update.