Sample
pretty-format 29.7.0: DEFAULT_OPTIONS
Verified sample for npm pretty-format 29.7.0: DEFAULT_OPTIONS. The contract ran on node 22 · linux alpine/x64 · docker and passed.
sha256:e86970c9798472092fbf1a962f670f8ff29981281ac3243bb2022cf8bdbc3db5
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@1 |
2026-08-21 |
Case
HOW- Goal
- verify pretty-format.DEFAULT_OPTIONS in pkg:npm/pretty-format@29.7.0
- Packages
- Symbols
-
- pretty-format.DEFAULT_OPTIONS
- Created
- 2026-08-21T05:57:19Z
Contract
- DEFAULT_OPTIONS exposes baseline formatting configuration with standard defaults
- getDefaultOptions returns a clone matching DEFAULT_OPTIONS
- isValidOptionKey validates option keys against DEFAULT_OPTIONS properties
- formatValue formats objects using default two-space indentation and properties
- formatValue supports custom option overrides including min and indent
- formatValue throws an error when unknown option keys not in DEFAULT_OPTIONS are provided
- formatValue respects the default callToJSON option
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- 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 pretty-format.DEFAULT_OPTIONS in pkg:npm/pretty-format@29.7.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/pretty-format@29.7.0
Demonstrate these symbols/APIs:
- 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:b17b2a11ee32e0a33ad39e86867284fe38be6ecc60b5f65295313c52b3fa3bb3","contract":["DEFAULT_OPTIONS exposes baseline formatting configuration with standard defaults","getDefaultOptions returns a clone matching DEFAULT_OPTIONS","isValidOptionKey validates option keys against DEFAULT_OPTIONS properties","formatValue formats objects using default two-space indentation and properties","formatValue supports custom option overrides including min and indent","formatValue throws an error when unknown option keys not in DEFAULT_OPTIONS are provided","formatValue respects the default callToJSON option"],"goal":"verify pretty-format.DEFAULT_OPTIONS in pkg:npm/pretty-format@29.7.0","kind":"HOW","packages":["pkg:npm/pretty-format@29.7.0"],"schemaVersion":1,"symbols":["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/pretty-format@29.7.0"],"schemaVersion":1,"subject":"pkg:npm/pretty-format@29.7.0","symbols":["pretty-format.DEFAULT_OPTIONS"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-pretty-format-default-options",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-pretty-format-default-options",
"version": "1.0.0",
"dependencies": {
"pretty-format": "29.7.0"
}
},
"node_modules/@jest/schemas": {
"version": "29.6.3",
"resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz",
"integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==",
"license": "MIT",
"dependencies": {
"@sinclair/typebox": "^0.27.8"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
}
},
"node_modules/@sinclair/typebox": {
"version": "0.27.12",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.12.tgz",
"integrity": "sha512-hhyNJ+nbR6ZR7pToHvllEFun9TL0sbL+tk/ON75lo+Xas054uez98qRbsuNt7MBCyZKK4+8Yli/OAGZhmfBZ/g==",
"license": "MIT"
},
"node_modules/ansi-styles": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz",
"integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",
"license": "MIT",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/pretty-format": {
"version": "29.7.0",
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz",
"integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==",
"license": "MIT",
"dependencies": {
"@jest/schemas": "^29.6.3",
"ansi-styles": "^5.0.0",
"react-is": "^18.0.0"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
}
},
"node_modules/react-is": {
"version": "18.3.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz",
"integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==",
"license": "MIT"
}
}
}
{
"name": "sample-pretty-format-default-options",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of pretty-format.DEFAULT_OPTIONS",
"main": "src/index.js",
"dependencies": {
"pretty-format": "29.7.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pretty-format.DEFAULT_OPTIONS in pkg:npm/pretty-format@29.7.0",
"kind": "HOW",
"packages": [
"pkg:npm/pretty-format@29.7.0"
],
"symbols": [
"pretty-format.DEFAULT_OPTIONS"
]
}
const { DEFAULT_OPTIONS, format } = require('pretty-format');
/**
* Returns a shallow copy of the default formatting options.
* @returns {typeof DEFAULT_OPTIONS}
*/
function getDefaultOptions() {
return { ...DEFAULT_OPTIONS };
}
/**
* Formats a given value using pretty-format with custom options merged over defaults.
* @param {unknown} value - Value to format.
* @param {object} [options] - Optional custom options.
* @returns {string}
*/
function formatValue(value, options) {
return format(value, options);
}
/**
* Checks whether a given configuration key is a recognized option in DEFAULT_OPTIONS.
* @param {string} key - Option key name to validate.
* @returns {boolean}
*/
function isValidOptionKey(key) {
return Object.prototype.hasOwnProperty.call(DEFAULT_OPTIONS, key);
}
module.exports = {
DEFAULT_OPTIONS,
getDefaultOptions,
formatValue,
isValidOptionKey
};
import assert from 'node:assert';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
DEFAULT_OPTIONS,
getDefaultOptions,
formatValue,
isValidOptionKey
} = require('../src/index.js');
// 1. DEFAULT_OPTIONS export structure
assert.strictEqual(typeof DEFAULT_OPTIONS, 'object', 'DEFAULT_OPTIONS must be an object');
assert.strictEqual(DEFAULT_OPTIONS.indent, 2, 'DEFAULT_OPTIONS.indent must be 2');
assert.strictEqual(DEFAULT_OPTIONS.callToJSON, true, 'DEFAULT_OPTIONS.callToJSON must be true');
assert.strictEqual(DEFAULT_OPTIONS.escapeString, true, 'DEFAULT_OPTIONS.escapeString must be true');
assert.strictEqual(DEFAULT_OPTIONS.escapeRegex, false, 'DEFAULT_OPTIONS.escapeRegex must be false');
assert.strictEqual(DEFAULT_OPTIONS.highlight, false, 'DEFAULT_OPTIONS.highlight must be false');
assert.strictEqual(DEFAULT_OPTIONS.min, false, 'DEFAULT_OPTIONS.min must be false');
assert.strictEqual(DEFAULT_OPTIONS.maxDepth, Infinity, 'DEFAULT_OPTIONS.maxDepth must be Infinity');
assert.strictEqual(DEFAULT_OPTIONS.maxWidth, Infinity, 'DEFAULT_OPTIONS.maxWidth must be Infinity');
assert.strictEqual(DEFAULT_OPTIONS.printBasicPrototype, true, 'DEFAULT_OPTIONS.printBasicPrototype must be true');
assert.strictEqual(DEFAULT_OPTIONS.printFunctionName, true, 'DEFAULT_OPTIONS.printFunctionName must be true');
assert.deepStrictEqual(DEFAULT_OPTIONS.plugins, [], 'DEFAULT_OPTIONS.plugins must be an empty array');
assert.deepStrictEqual(DEFAULT_OPTIONS.theme, {
comment: 'gray',
content: 'reset',
prop: 'yellow',
tag: 'cyan',
value: 'green'
}, 'DEFAULT_OPTIONS.theme must have standard default theme keys');
// 2. getDefaultOptions helper returns a valid clone
const clonedDefaults = getDefaultOptions();
assert.deepStrictEqual(clonedDefaults, DEFAULT_OPTIONS);
assert.notStrictEqual(clonedDefaults, DEFAULT_OPTIONS);
// 3. isValidOptionKey uses DEFAULT_OPTIONS to recognize valid options
assert.strictEqual(isValidOptionKey('indent'), true);
assert.strictEqual(isValidOptionKey('callToJSON'), true);
assert.strictEqual(isValidOptionKey('plugins'), true);
assert.strictEqual(isValidOptionKey('nonExistentOption'), false);
// 4. Default formatting behavior
const testObj = {
active: true,
count: 10,
label: 'sample'
};
const defaultOutput = formatValue(testObj);
assert.strictEqual(
defaultOutput,
'Object {\n "active": true,\n "count": 10,\n "label": "sample",\n}'
);
// 5. Custom option override respects formatting options
const minifiedOutput = formatValue(testObj, { min: true });
assert.strictEqual(minifiedOutput, '{"active": true, "count": 10, "label": "sample"}');
const indent4Output = formatValue({ key: 'val' }, { indent: 4 });
assert.strictEqual(indent4Output, 'Object {\n "key": "val",\n}');
// 6. Unknown options rejection based on DEFAULT_OPTIONS schema
assert.throws(
() => formatValue(testObj, { invalidKey: true }),
/pretty-format: Unknown option "invalidKey"\./
);
// 7. callToJSON behavior
const objWithToJSON = {
secret: 'hide',
toJSON() {
return { visible: true };
}
};
assert.strictEqual(
formatValue(objWithToJSON),
'Object {\n "visible": true,\n}'
);
assert.strictEqual(
formatValue(objWithToJSON, { callToJSON: false }),
'Object {\n "secret": "hide",\n "toJSON": [Function toJSON],\n}'
);
console.log('Contract tests passed successfully.');
Origin Seeder
anonymous