Exemplo
@vitest/utils 3.2.7
Amostra verificada para npm @vitest/utils 3.2.7. O contrato rodou em node 22 · linux alpine/x64 · docker e passou: getType distinguishes JavaScript types…
sha256:504f1df42dd8b3834d48574c1b5cc3804568de56dda74c0afd30dc3a4e6ec94f
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
linux 24 · ubuntu · glibc 2.39 x64 npm
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| 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 |
Caso
HOW- Objetivo
- verify pkg:npm/%40vitest/utils@3.2.7
- Pacotes
- Criado
- 2026-08-23T14:55:18Z
Contrato
- getType distinguishes JavaScript types including primitives, collections, and built-ins
- deepClone creates an independent deep copy of nested objects and arrays
- deepMerge deeply merges source object properties into target object
- createDefer creates a Promise with attached resolve and reject methods
- slash normalizes Windows backslash paths to Unix forward slashes
- toArray converts nullish values to empty arrays and wraps non-array values in single-element arrays
- isObject identifies object structures while returning false for arrays, functions, and primitives
- isPrimitive identifies JavaScript primitive values and rejects object structures
- parseRegexp parses stringified regular expressions into RegExp instances
- nanoid generates random identifier strings with default and custom lengths
Arquivos
- PROMPT.md
- csx.json
- index.mjs
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Código-fonte
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 pkg:npm/%40vitest/utils@3.2.7
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40vitest/utils@3.2.7
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:9d637024f073b5a7c459fb535471342569b61310ded9314081d963decd72f542","contract":["getType distinguishes JavaScript types including primitives, collections, and built-ins","deepClone creates an independent deep copy of nested objects and arrays","deepMerge deeply merges source object properties into target object","createDefer creates a Promise with attached resolve and reject methods","slash normalizes Windows backslash paths to Unix forward slashes","toArray converts nullish values to empty arrays and wraps non-array values in single-element arrays","isObject identifies object structures while returning false for arrays, functions, and primitives","isPrimitive identifies JavaScript primitive values and rejects object structures","parseRegexp parses stringified regular expressions into RegExp instances","nanoid generates random identifier strings with default and custom lengths"],"goal":"verify pkg:npm/%40vitest/utils@3.2.7","kind":"HOW","packages":["pkg:npm/%40vitest/utils@3.2.7"],"schemaVersion":1},"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/utils@3.2.7"],"schemaVersion":1,"subject":"pkg:npm/%40vitest/utils@3.2.7","verifierAdapter":"node-typescript@1"}
import {
getType,
deepMerge,
deepClone,
createDefer,
slash,
toArray,
isObject,
isPrimitive,
notNullish,
parseRegexp,
nanoid,
stringify
} from '@vitest/utils';
export {
getType,
deepMerge,
deepClone,
createDefer,
slash,
toArray,
isObject,
isPrimitive,
notNullish,
parseRegexp,
nanoid,
stringify
};
export function cloneAndMerge(target, source) {
const clonedTarget = deepClone(target);
return deepMerge(clonedTarget, source);
}
export function createResolvedDefer(value) {
const deferred = createDefer();
deferred.resolve(value);
return deferred;
}
{
"name": "sample-vitest-utils",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-vitest-utils",
"version": "1.0.0",
"dependencies": {
"@vitest/utils": "3.2.7"
}
},
"node_modules/@vitest/pretty-format": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-3.2.7.tgz",
"integrity": "sha512-KUHlwqVu0sRlhCdyPdQ/wBoTfRahjUky1MubOmYw9fWfIZy1gNoHpuaaQBPAaMaVYdQYHJLurzj8ECCj5OwTqA==",
"license": "MIT",
"dependencies": {
"tinyrainbow": "^2.0.0"
},
"funding": {
"url": "https://opencollective.com/vitest"
}
},
"node_modules/@vitest/utils": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-3.2.7.tgz",
"integrity": "sha512-x6BDOd7dyo3PFLY3I9/HJ25X/6OurhGXk2/B9gOZNPF7XDVjeBK4k01lQE5uvDpbuheErh91qYuE1E2OEjK3Rw==",
"license": "MIT",
"dependencies": {
"@vitest/pretty-format": "3.2.7",
"loupe": "^3.1.4",
"tinyrainbow": "^2.0.0"
},
"funding": {
"url": "https://opencollective.com/vitest"
}
},
"node_modules/loupe": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/loupe/-/loupe-3.2.1.tgz",
"integrity": "sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==",
"license": "MIT"
},
"node_modules/tinyrainbow": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-2.0.0.tgz",
"integrity": "sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==",
"license": "MIT",
"engines": {
"node": ">=14.0.0"
}
}
}
}
{
"name": "sample-vitest-utils",
"version": "1.0.0",
"description": "Clean-room verification sample for @vitest/utils",
"type": "module",
"main": "index.mjs",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"@vitest/utils": "3.2.7"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40vitest/utils@3.2.7",
"kind": "HOW",
"packages": [
"pkg:npm/%40vitest/utils@3.2.7"
]
}
import assert from 'node:assert/strict';
import {
getType,
deepMerge,
deepClone,
createDefer,
slash,
toArray,
isObject,
isPrimitive,
notNullish,
parseRegexp,
nanoid,
stringify
} from '@vitest/utils';
import { cloneAndMerge, createResolvedDefer } from '../index.mjs';
// 1. getType distinguishes JavaScript types including primitives, collections, and built-ins
{
assert.equal(getType(null), 'Null');
assert.equal(getType(undefined), 'Undefined');
assert.equal(getType(123), 'Number');
assert.equal(getType('test'), 'String');
assert.equal(getType(true), 'Boolean');
assert.equal(getType(Symbol('sym')), 'Symbol');
assert.equal(getType(10n), 'BigInt');
assert.equal(getType([]), 'Array');
assert.equal(getType({}), 'Object');
assert.equal(getType(/abc/), 'RegExp');
assert.equal(getType(new Set()), 'Set');
assert.equal(getType(new Map()), 'Map');
assert.equal(getType(Promise.resolve()), 'Promise');
assert.equal(getType(new Date()), 'Date');
}
// 2. deepClone creates an independent deep copy of nested objects and arrays
{
const original = {
num: 1,
nested: { str: 'alpha' },
arr: [1, { val: 2 }],
};
const copy = deepClone(original);
assert.deepEqual(copy, original);
assert.notEqual(copy, original);
assert.notEqual(copy.nested, original.nested);
assert.notEqual(copy.arr, original.arr);
assert.notEqual(copy.arr[1], original.arr[1]);
}
// 3. deepMerge deeply merges source object properties into target object
{
const target = { a: 1, nested: { b: 2, c: 3 } };
const source = { nested: { c: 4, d: 5 }, e: 6 };
const merged = deepMerge(target, source);
assert.equal(merged, target);
assert.deepEqual(target, {
a: 1,
nested: { b: 2, c: 4, d: 5 },
e: 6,
});
assert.deepEqual(source, { nested: { c: 4, d: 5 }, e: 6 });
// Test helper function cloneAndMerge
const originalObj = { x: 10, inner: { y: 20 } };
const patch = { inner: { z: 30 } };
const mergedCopy = cloneAndMerge(originalObj, patch);
assert.deepEqual(mergedCopy, { x: 10, inner: { y: 20, z: 30 } });
assert.equal(originalObj.inner.z, undefined);
}
// 4. createDefer creates a Promise with attached resolve and reject methods
{
const deferred = createDefer();
assert.ok(deferred instanceof Promise);
assert.equal(typeof deferred.resolve, 'function');
assert.equal(typeof deferred.reject, 'function');
deferred.resolve('completed');
const result = await deferred;
assert.equal(result, 'completed');
// Test helper function createResolvedDefer
const helperDefer = createResolvedDefer('fast-resolved');
const helperResult = await helperDefer;
assert.equal(helperResult, 'fast-resolved');
}
// 5. slash normalizes Windows backslash paths to Unix forward slashes
{
assert.equal(slash('foo\\bar\\baz.js'), 'foo/bar/baz.js');
assert.equal(slash('nested\\dir\\sub\\index.js'), 'nested/dir/sub/index.js');
assert.equal(slash('already/forward/slash'), 'already/forward/slash');
}
// 6. toArray converts nullish values to empty arrays and wraps non-array values in single-element arrays
{
assert.deepEqual(toArray(null), []);
assert.deepEqual(toArray(undefined), []);
assert.deepEqual(toArray('single'), ['single']);
assert.deepEqual(toArray(42), [42]);
const arr = [1, 2, 3];
assert.equal(toArray(arr), arr);
}
// 7. isObject identifies object structures while returning false for arrays, functions, and primitives
{
assert.equal(isObject({}), true);
assert.equal(isObject(Object.create(null)), true);
assert.equal(isObject(new Map()), true);
assert.equal(isObject(new Set()), true);
assert.equal(isObject([]), false);
assert.equal(isObject(() => {}), false);
assert.equal(isObject(null), false);
assert.equal(isObject(undefined), false);
assert.equal(isObject('string'), false);
assert.equal(isObject(123), false);
}
// 8. isPrimitive identifies JavaScript primitive values and rejects object structures
{
assert.equal(isPrimitive('str'), true);
assert.equal(isPrimitive(123), true);
assert.equal(isPrimitive(true), true);
assert.equal(isPrimitive(null), true);
assert.equal(isPrimitive(undefined), true);
assert.equal(isPrimitive(Symbol('s')), true);
assert.equal(isPrimitive(10n), true);
assert.equal(isPrimitive({}), false);
assert.equal(isPrimitive([]), false);
assert.equal(isPrimitive(() => {}), false);
}
// 9. parseRegexp parses stringified regular expressions into RegExp instances
{
const parsed = parseRegexp('/^test[0-9]+$/gi');
assert.ok(parsed instanceof RegExp);
assert.equal(parsed.source, '^test[0-9]+$');
assert.equal(parsed.flags, 'gi');
assert.ok(parsed.test('TEST123'));
assert.ok(!parsed.test('other'));
}
// 10. nanoid generates random identifier strings with default and custom lengths
{
const id1 = nanoid();
const id2 = nanoid();
assert.equal(typeof id1, 'string');
assert.equal(id1.length, 21);
assert.notEqual(id1, id2);
const customId = nanoid(10);
assert.equal(typeof customId, 'string');
assert.equal(customId.length, 10);
}
console.log('All @vitest/utils contract assertions passed.');
Seeder de origem
anônimo