Sample
@vitest/mocker 3.2.7: AutospiedModule
Verified sample for npm @vitest/mocker 3.2.7: AutospiedModule. The contract ran on node 22 · linux alpine/x64 · docker and passed.
sha256:b6346f51e05875c1b536957439ff20f35ce48380b33746d05847567a3bb95c9b
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
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 npm
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-23 |
Case
HOW- Goal
- verify @vitest/mocker.AutospiedModule in pkg:npm/%40vitest/mocker@3.2.7
- Packages
- Symbols
-
- @vitest/mocker.AutospiedModule
- Created
- 2026-08-23T14:47:07Z
Contract
- assert AutospiedModule constructor stores raw, id, url and type autospy
- assert toJSON returns serialized autospy mock descriptor
- assert AutospiedModule.fromJSON recreates an AutospiedModule instance from serialized data
- assert MockerRegistry registers AutospiedModule and maps by url and id
- assert MockerRegistry.register accepts serialized JSON descriptor for autospy
- assert MockerRegistry.register rejects direct AutospiedModule instance
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify @vitest/mocker.AutospiedModule in pkg:npm/%40vitest/mocker@3.2.7
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40vitest/mocker@3.2.7
Demonstrate these symbols/APIs:
- @vitest/mocker.AutospiedModule
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:85a31cd4e2edd6b713978ca5384d239fc6c317a4100c937af48dfc4a7e427bdb","contract":["assert AutospiedModule constructor stores raw, id, url and type autospy","assert toJSON returns serialized autospy mock descriptor","assert AutospiedModule.fromJSON recreates an AutospiedModule instance from serialized data","assert MockerRegistry registers AutospiedModule and maps by url and id","assert MockerRegistry.register accepts serialized JSON descriptor for autospy","assert MockerRegistry.register rejects direct AutospiedModule instance"],"goal":"verify @vitest/mocker.AutospiedModule in pkg:npm/%40vitest/mocker@3.2.7","kind":"HOW","packages":["pkg:npm/%40vitest/mocker@3.2.7"],"schemaVersion":1,"symbols":["@vitest/mocker.AutospiedModule"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40vitest/mocker@3.2.7"],"schemaVersion":1,"subject":"pkg:npm/%40vitest/mocker@3.2.7","symbols":["@vitest/mocker.AutospiedModule"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-vitest-mocker",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-vitest-mocker",
"version": "1.0.0",
"dependencies": {
"@vitest/mocker": "3.2.7"
}
},
"node_modules/@jridgewell/sourcemap-codec": {
"version": "1.5.5",
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
"integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
"license": "MIT"
},
"node_modules/@types/estree": {
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz",
"integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==",
"license": "MIT"
},
"node_modules/@vitest/mocker": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-3.2.7.tgz",
"integrity": "sha512-Trr0hYO9CM3Wj6ksWHRhK9IZpIY6wTMO5u/MqXurMxT57sWBaOPEtP3Oq60ihZuh5JsiagKfz95OcxdEP6dBrA==",
"license": "MIT",
"dependencies": {
"@vitest/spy": "3.2.7",
"estree-walker": "^3.0.3",
"magic-string": "^0.30.17"
},
"funding": {
"url": "https://opencollective.com/vitest"
},
"peerDependencies": {
"msw": "^2.4.9",
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0"
},
"peerDependenciesMeta": {
"msw": {
"optional": true
},
"vite": {
"optional": true
}
}
},
"node_modules/@vitest/spy": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-3.2.7.tgz",
"integrity": "sha512-Q2eQGI6d2L/hBtZ0qNuKcAGid68XK6cv1xsoaIma6PaJhHPoqcEJhYpXZ/5myCMqkNgtP6UKuBhbc0nHKnrkuQ==",
"license": "MIT",
"dependencies": {
"tinyspy": "^4.0.3"
},
"funding": {
"url": "https://opencollective.com/vitest"
}
},
"node_modules/estree-walker": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",
"integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",
"license": "MIT",
"dependencies": {
"@types/estree": "^1.0.0"
}
},
"node_modules/magic-string": {
"version": "0.30.21",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",
"integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==",
"license": "MIT",
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.5.5"
}
},
"node_modules/tinyspy": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-4.0.4.tgz",
"integrity": "sha512-azl+t0z7pw/z958Gy9svOTuzqIk6xq+NSheJzn5MMWtWTFywIacg2wUlzKFGtt3cthx0r2SxMK0yzJOR0IES7Q==",
"license": "MIT",
"engines": {
"node": ">=14.0.0"
}
}
}
}
{
"name": "sample-vitest-mocker",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"@vitest/mocker": "3.2.7"
}
}
{
"schemaVersion": 1,
"goal": "verify @vitest/mocker.AutospiedModule in pkg:npm/%40vitest/mocker@3.2.7",
"kind": "HOW",
"packages": [
"pkg:npm/%40vitest/mocker@3.2.7"
],
"symbols": [
"@vitest/mocker.AutospiedModule"
]
}
import assert from 'node:assert/strict';
import { AutospiedModule, MockerRegistry } from '@vitest/mocker';
// 1. Constructor and properties
const raw = 'my-module';
const id = '/path/to/my-module.js';
const url = 'file:///path/to/my-module.js';
const autospied = new AutospiedModule(raw, id, url);
assert.equal(autospied.type, 'autospy');
assert.equal(autospied.raw, raw);
assert.equal(autospied.id, id);
assert.equal(autospied.url, url);
// 2. toJSON serialization
const serialized = autospied.toJSON();
assert.deepEqual(serialized, {
type: 'autospy',
raw: 'my-module',
id: '/path/to/my-module.js',
url: 'file:///path/to/my-module.js'
});
// 3. fromJSON deserialization
const restored = AutospiedModule.fromJSON(serialized);
assert(restored instanceof AutospiedModule);
assert.equal(restored.type, 'autospy');
assert.equal(restored.raw, raw);
assert.equal(restored.id, id);
assert.equal(restored.url, url);
assert.deepEqual(restored.toJSON(), serialized);
// 4. MockerRegistry integration
const registry = new MockerRegistry();
registry.add(autospied);
assert.equal(registry.has(url), true);
assert.equal(registry.get(url), autospied);
assert.equal(registry.getById(id), autospied);
// 5. MockerRegistry register with arguments
const registered = registry.register('autospy', 'other-module', '/path/to/other.js', 'file:///path/to/other.js');
assert(registered instanceof AutospiedModule);
assert.equal(registered.type, 'autospy');
assert.equal(registered.raw, 'other-module');
assert.equal(registered.id, '/path/to/other.js');
assert.equal(registered.url, 'file:///path/to/other.js');
assert.equal(registry.get('file:///path/to/other.js'), registered);
assert.equal(registry.getById('/path/to/other.js'), registered);
// 6. MockerRegistry register with serialized JSON
const fromJsonRegistered = registry.register({
type: 'autospy',
raw: 'json-module',
id: '/path/to/json.js',
url: 'file:///path/to/json.js'
});
assert(fromJsonRegistered instanceof AutospiedModule);
assert.equal(fromJsonRegistered.type, 'autospy');
assert.equal(fromJsonRegistered.raw, 'json-module');
assert.equal(registry.get('file:///path/to/json.js'), fromJsonRegistered);
// 7. MockerRegistry refuses instance in register()
assert.throws(() => {
registry.register(autospied);
}, /Cannot register a mock that is already defined/);
console.log('All AutospiedModule contract assertions passed.');
Origin Seeder
anonymous