Пример
vitest 4.1.10: Run a real vitest suite with no network, and know which of its matchers disagree with each other
Проверенный пример — npm vitest 4.1.10: Run a real vitest suite with no network, and know which of its matchers disagree with each other. Контракт выполнен…
sha256:6c28ffd780aef897dcac706acedb270bbeded523f0b0570d4755789de89cb4ab
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
MIT-0
Свидетельства выполнения
Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.
- Основа свидетельства
- Подписанный контракт пройден
- Квитанции проверки
- 2
- Ключи подписи, собравшие его
- 2
Заявленная среда
node 22 linux alpine x64 node 22 javascript npm
Среды запусков проверки
| Окружение | Контракт | Этапы | Запуск |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:a2ec939a4c60e243 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · npm@1 |
2026-08-14 |
| node 22 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · npm@1 |
2026-08-18 |
Кейс
HOW- Цель
- Run a real vitest suite with no network, and know which of its matchers disagree with each other
- Пакеты
- Символы
-
- expect.toEqual
- expect.toStrictEqual
- expect.rejects
- expect.toThrow
- vi.useFakeTimers
- vi.advanceTimersByTime
- vi.advanceTimersByTimeAsync
- startVitest
- Окружение
- node 22
- Создан
- 2026-08-14T09:41:37Z
Контракт
- run the suite with the network off on node:22-alpine, through vitest's node API
- assert five tests were collected and every one of them passed rather than skipped
- assert toEqual ignores an own property whose value is undefined, and toStrictEqual reports it
- assert toStrictEqual also rejects a class instance whose fields toEqual accepts
- assert advanceTimersByTime fires a setTimeout without waiting, and moves the faked Date by the same amount
- assert a cancelled timer never fires however far the clock is advanced
- assert advanceTimersByTime does not flush the microtask a timer's resolve queues, and advanceTimersByTimeAsync does
- assert await expect(...).rejects reports the rejection, while the bare call compares nothing and returns a thenable that is not a Promise
- assert toThrow sees no error from an async function, because the failure is a rejected promise and not a throw
- assert toBe is Object.is: NaN matches NaN, while -0 matches neither toBe(0) nor toEqual(0)
- run a second suite that forgets the await on two false .rejects assertions, and assert that run reports two tests and leaves process.exitCode at 1
- assert the forgotten await in a sync test function fails that test, carrying the real rejection message in the error
- assert the forgotten await in an async test function leaves the test reported as passed while the failure becomes the run's one unhandled error
Файлы
- csx.json
- package-lock.json
- package.json
- src/config.mjs
- src/scheduler.mjs
- test/contract.mjs
- test/not-awaited-rejects.mjs
- test/vitest-traps.test.mjs
- vitest.config.mjs