CodeSampleX

Sample

vitest 4.1.10: Run a real vitest suite with no network, and know which of its matchers disagree with each other

Verified sample for npm vitest 4.1.10: Run a real vitest suite with no network, and know which of its matchers disagree with each other. The contract ran on…

sha256:6c28ffd780aef897dcac706acedb270bbeded523f0b0570d4755789de89cb4ab

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
2
Signing keys that built it
2
Declared environment node 22 linux alpine x64 node 22 javascript npm

Verification-run environments

Environment Contract Stages Run
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

Case

HOW
Goal
Run a real vitest suite with no network, and know which of its matchers disagree with each other
Packages
Symbols
  • expect.toEqual
  • expect.toStrictEqual
  • expect.rejects
  • expect.toThrow
  • vi.useFakeTimers
  • vi.advanceTimersByTime
  • vi.advanceTimersByTimeAsync
  • startVitest
Environment
node 22
Created
2026-08-14T09:41:37Z

Contract

  1. run the suite with the network off on node:22-alpine, through vitest's node API
  2. assert five tests were collected and every one of them passed rather than skipped
  3. assert toEqual ignores an own property whose value is undefined, and toStrictEqual reports it
  4. assert toStrictEqual also rejects a class instance whose fields toEqual accepts
  5. assert advanceTimersByTime fires a setTimeout without waiting, and moves the faked Date by the same amount
  6. assert a cancelled timer never fires however far the clock is advanced
  7. assert advanceTimersByTime does not flush the microtask a timer's resolve queues, and advanceTimersByTimeAsync does
  8. assert await expect(...).rejects reports the rejection, while the bare call compares nothing and returns a thenable that is not a Promise
  9. assert toThrow sees no error from an async function, because the failure is a rejected promise and not a throw
  10. assert toBe is Object.is: NaN matches NaN, while -0 matches neither toBe(0) nor toEqual(0)
  11. 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
  12. assert the forgotten await in a sync test function fails that test, carrying the real rejection message in the error
  13. 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

Files

  • 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

Download the source artifact (tar.gz)

Origin Seeder

anonymous