示例
Run a real vitest suite with no network, and know which of its matchers disagree with each other
sha256:6c28ffd780aef897dcac706acedb270bbeded523f0b0570d4755789de89cb4ab
CROSS_PASS
L4_CROSS_PASS
MIT-0
案例
- 目标
- Run a real vitest suite with no network, and know which of its matchers disagree with each other HOW
- 包
- vitest 4.1.10 vite 8.2.1
- 环境
- 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
原始种子者
验证回执
- node 22 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · npm@1 · 2026-08-14 · ed25519:a2ec939a4c60e243
- · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · npm@1 · 2026-08-14 · ed25519:7da3f610facce8bf
- · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · npm@1 · 2026-08-14 · ed25519:7da3f610facce8bf
- · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · npm@1 · 2026-08-14 · ed25519:7da3f610facce8bf
- · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · npm@1 · 2026-08-14 · ed25519:7da3f610facce8bf