Пример
@vitest/pretty-format 4.1.10: DEFAULT_OPTIONS
Проверенный пример — npm @vitest/pretty-format 4.1.10: DEFAULT_OPTIONS. Контракт выполнен на node 22 · linux debian/x64 · docker и пройден.
sha256:dcd6f8cabd51e63c69f97a2a256603d5c274da8dfb9b8fcd66e0f5523e6a396f
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
MIT-0
Свидетельства выполнения
Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.
- Основа свидетельства
- Подписанный контракт пройден
- Квитанции проверки
- 1
- Ключи подписи, собравшие его
- 1
Заявленная среда
linux 24 · ubuntu · glibc 2.39 x64 npm
Среды запусков проверки
| Окружение | Контракт | Этапы | Запуск |
|---|---|---|---|
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-05 |
Кейс
HOW- Цель
- verify @vitest/pretty-format.DEFAULT_OPTIONS in pkg:npm/%40vitest/pretty-format@4.1.10
- Пакеты
- Символы
-
- @vitest/pretty-format.DEFAULT_OPTIONS
- Создан
- 2026-09-05T21:50:22Z
Контракт
- DEFAULT_OPTIONS exports default configuration object with expected formatting flags and numeric limits
- DEFAULT_OPTIONS defines default syntax theme colors for comment, content, prop, tag, and value
- format applies DEFAULT_OPTIONS callToJSON to invoke toJSON method by default and preserves raw object when false
- format applies DEFAULT_OPTIONS printBasicPrototype to prefix Object and Array headers by default and omits them when false
- format applies DEFAULT_OPTIONS escapeString and escapeRegex behavior for strings and regular expressions
- format applies DEFAULT_OPTIONS indent and min options to govern whitespace and single-line compact serialization
Файлы
- PROMPT.md
- csx.json
- index.mjs
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Исходный код
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/pretty-format.DEFAULT_OPTIONS in pkg:npm/%40vitest/pretty-format@4.1.10
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40vitest/pretty-format@4.1.10
Demonstrate these symbols/APIs:
- @vitest/pretty-format.DEFAULT_OPTIONS
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:d66645a0c539988c0c4c337cf8a42dd76295c3112f690343b6ec60ad67217ca8","contract":["DEFAULT_OPTIONS exports default configuration object with expected formatting flags and numeric limits","DEFAULT_OPTIONS defines default syntax theme colors for comment, content, prop, tag, and value","format applies DEFAULT_OPTIONS callToJSON to invoke toJSON method by default and preserves raw object when false","format applies DEFAULT_OPTIONS printBasicPrototype to prefix Object and Array headers by default and omits them when false","format applies DEFAULT_OPTIONS escapeString and escapeRegex behavior for strings and regular expressions","format applies DEFAULT_OPTIONS indent and min options to govern whitespace and single-line compact serialization"],"goal":"verify @vitest/pretty-format.DEFAULT_OPTIONS in pkg:npm/%40vitest/pretty-format@4.1.10","kind":"HOW","packages":["pkg:npm/%40vitest/pretty-format@4.1.10"],"schemaVersion":1,"symbols":["@vitest/pretty-format.DEFAULT_OPTIONS"]},"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/pretty-format@4.1.10"],"schemaVersion":1,"subject":"pkg:npm/%40vitest/pretty-format@4.1.10","symbols":["@vitest/pretty-format.DEFAULT_OPTIONS"],"verifierAdapter":"node-typescript@1"}
import { DEFAULT_OPTIONS, format, plugins } from '@vitest/pretty-format';
export { DEFAULT_OPTIONS, format, plugins };
export function formatWithDefaultOptions(value, overrides = {}) {
return format(value, { ...DEFAULT_OPTIONS, ...overrides });
}
export function getDefaultOptions() {
return { ...DEFAULT_OPTIONS };
}
{
"name": "sample-vitest-pretty-format-default-options",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-vitest-pretty-format-default-options",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@vitest/pretty-format": "4.1.10"
}
},
"node_modules/@vitest/pretty-format": {
"version": "4.1.10",
"resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.10.tgz",
"integrity": "sha512-W1HsjSH4MXQ9YfmmhLAoIYf1HRfekQCGngeIgcei6MP5QQGWUe0gkopdZQaVCFO+JDJMrAJGwa5pRpNpvy4P8Q==",
"license": "MIT",
"dependencies": {
"tinyrainbow": "^3.1.0"
},
"funding": {
"url": "https://opencollective.com/vitest"
}
},
"node_modules/tinyrainbow": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.1.1.tgz",
"integrity": "sha512-yau8yJdTt989Mm0Bd/236QnzEiPf2xLLTqUZRUJOo/3CB078LSwzei343DgtJVmfJKJE3TMINY1u42SQsP6mXw==",
"license": "MIT",
"engines": {
"node": ">=14.0.0"
}
}
}
}
{
"name": "sample-vitest-pretty-format-default-options",
"version": "1.0.0",
"description": "Clean-room verification sample for @vitest/pretty-format DEFAULT_OPTIONS",
"type": "module",
"main": "index.mjs",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"@vitest/pretty-format": "4.1.10"
}
}
{
"schemaVersion": 1,
"goal": "verify @vitest/pretty-format.DEFAULT_OPTIONS in pkg:npm/%40vitest/pretty-format@4.1.10",
"kind": "HOW",
"packages": [
"pkg:npm/%40vitest/pretty-format@4.1.10"
],
"symbols": [
"@vitest/pretty-format.DEFAULT_OPTIONS"
]
}
import assert from 'node:assert/strict';
import { DEFAULT_OPTIONS, format } from '@vitest/pretty-format';
import { formatWithDefaultOptions, getDefaultOptions } from '../index.mjs';
// 1. DEFAULT_OPTIONS exports default configuration object with expected formatting flags and numeric limits
{
assert.equal(typeof DEFAULT_OPTIONS, 'object');
assert.notEqual(DEFAULT_OPTIONS, null);
assert.equal(DEFAULT_OPTIONS.callToJSON, true);
assert.equal(DEFAULT_OPTIONS.indent, 2);
assert.equal(DEFAULT_OPTIONS.maxDepth, Infinity);
assert.equal(DEFAULT_OPTIONS.maxWidth, Infinity);
assert.equal(DEFAULT_OPTIONS.maxOutputLength, 1000000);
assert.equal(DEFAULT_OPTIONS.min, false);
assert.equal(DEFAULT_OPTIONS.printFunctionName, true);
assert.equal(DEFAULT_OPTIONS.printBasicPrototype, true);
assert.equal(DEFAULT_OPTIONS.printShadowRoot, true);
assert.equal(DEFAULT_OPTIONS.highlight, false);
assert.equal(DEFAULT_OPTIONS.escapeRegex, false);
assert.equal(DEFAULT_OPTIONS.escapeString, true);
assert.equal(DEFAULT_OPTIONS.compareKeys, undefined);
assert.ok(Array.isArray(DEFAULT_OPTIONS.plugins));
assert.equal(DEFAULT_OPTIONS.plugins.length, 0);
const copied = getDefaultOptions();
assert.equal(copied.indent, 2);
assert.equal(copied.callToJSON, true);
}
// 2. DEFAULT_OPTIONS defines default syntax theme colors for comment, content, prop, tag, and value
{
assert.equal(typeof DEFAULT_OPTIONS.theme, 'object');
assert.notEqual(DEFAULT_OPTIONS.theme, null);
assert.equal(DEFAULT_OPTIONS.theme.comment, 'gray');
assert.equal(DEFAULT_OPTIONS.theme.content, 'reset');
assert.equal(DEFAULT_OPTIONS.theme.prop, 'yellow');
assert.equal(DEFAULT_OPTIONS.theme.tag, 'cyan');
assert.equal(DEFAULT_OPTIONS.theme.value, 'green');
}
// 3. format applies DEFAULT_OPTIONS callToJSON to invoke toJSON method by default and preserves raw object when false
{
const obj = {
raw: 'data',
toJSON() {
return { converted: true };
},
};
const defaultFormatted = format(obj);
assert.ok(defaultFormatted.includes('"converted": true'));
assert.ok(!defaultFormatted.includes('"raw": "data"'));
const rawFormatted = format(obj, { callToJSON: false });
assert.ok(rawFormatted.includes('"raw": "data"'));
const helperFormatted = formatWithDefaultOptions(obj);
assert.ok(helperFormatted.includes('"converted": true'));
}
// 4. format applies DEFAULT_OPTIONS printBasicPrototype to prefix Object and Array headers by default and omits them when false
{
const obj = { a: 1 };
assert.ok(format(obj).startsWith('Object {'));
assert.ok(format(obj, { printBasicPrototype: false }).startsWith('{'));
const arr = [1];
assert.ok(format(arr).startsWith('Array ['));
assert.ok(format(arr, { printBasicPrototype: false }).startsWith('['));
}
// 5. format applies DEFAULT_OPTIONS escapeString and escapeRegex behavior for strings and regular expressions
{
const str = 'quote " test';
assert.equal(format(str), '"quote \\" test"');
assert.equal(format(str, { escapeString: false }), '"quote " test"');
const regex = /a+b/;
assert.equal(format(regex), '/a+b/');
assert.equal(format(regex, { escapeRegex: true }), '/a\\+b/');
}
// 6. format applies DEFAULT_OPTIONS indent and min options to govern whitespace and single-line compact serialization
{
const data = { key: 1 };
assert.equal(format(data), 'Object {\n "key": 1,\n}');
assert.equal(format(data, { indent: 4 }), 'Object {\n "key": 1,\n}');
assert.equal(format(data, { min: true }), '{"key": 1}');
}
console.log('All @vitest/pretty-format.DEFAULT_OPTIONS contract assertions passed.');
Исходный сидер
аноним