Exemple
Disprove the belief that fake-timer time seeding accepts arbitrary date strings.
sha256:143845512869b47a10e49289da6c1a5aa1c10b29acd92cd7bc7f166b4c5bbbae
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Cas
- Objectif
- Disprove the belief that fake-timer time seeding accepts arbitrary date strings. HOW
- Paquets
- jest 30.4.2
- Environnement
- node
- Créé
- 2026-08-17T03:17:22Z
Ce que l'on suppose souvent
A strong implementation instinct is that `jest.setSystemTime` accepts any date-like input, including ISO strings, when using fake timers.
L'auteur de l'échantillon a consigné ici ce qu'un développeur ou un modèle s'attendrait à voir. Le contrat ci-dessous est ce qui s'est réellement exécuté.
Contrat
- Calling `jest.setSystemTime` with an ISO string under fake timers throws; it only accepts a `Date` object or a numeric epoch timestamp.
- After `jest.useFakeTimers()` and `jest.setSystemTime(new Date('2020-01-02T00:00:00.000Z'))`, `Date.now()` equals that date's epoch milliseconds.
Fichiers
- NOTES.md
- csx.json
- package-lock.json
- package.json
- test/contract.test.mjs
Télécharger l'artefact vérifié (tar.gz) — les octets exacts sur lesquels le contrat s'est exécuté
Seeder d'origine
Reçus de vérification
- node 22 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-17 · ed25519:d91480838ac982c9