Exemple
browserslist 4.28.7: findConfig
Échantillon vérifié pour npm browserslist 4.28.7: findConfig. Le contrat s'est exécuté sur node 22 · linux debian/x64 · docker et a réussi.
sha256:d2671adbcd8256544473d03ffdfa5417b6e406544a5b0ee89e2362df35a6053b
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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-17 |
Cas
HOW- Objectif
- verify browserslist.findConfig in pkg:npm/browserslist@4.28.7
- Paquets
- Symboles
-
- browserslist.findConfig
- Environnement
- node 22.23.2
- Créé
- 2026-09-17T01:36:24Z
Contrat
- browserslist.findConfig(dir) discovers .browserslistrc files and returns structured section mappings
- browserslist.findConfig(dir) discovers package.json browserslist array configurations and wraps them under defaults
- browserslist.findConfig(dir) discovers package.json browserslist object configurations without adding defaults
- browserslist.findConfig(dir) returns undefined when no configuration file exists in the directory tree
Fichiers
- NOTES.md
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Code source
# browserslist.findConfig Behavior
## Pinned Release
- `browserslist`: `4.28.7` (resolved via `npm`)
- Runtime: Node.js (tested on Node 22 ESM)
## Observed Behavior & Contract Details
### 1. Configuration Discovery (`findConfig`)
- `browserslist.findConfig(path)` searches upward for `.browserslistrc` or `package.json` with a `browserslist` property.
- When discovering `.browserslistrc`, it returns structured section mappings (`{ defaults: [...], ...sections }`).
- When discovering `package.json` with an array `browserslist`, it wraps queries under `{ defaults: [...] }`.
- When discovering `package.json` with an object `browserslist`, it returns section mappings directly without inserting a `defaults` array.
- When no configuration file exists in the directory hierarchy, it returns `undefined`.
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 browserslist.findConfig in pkg:npm/browserslist@4.28.7
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/browserslist@4.28.7
Demonstrate these symbols/APIs:
- browserslist.findConfig
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:29c791479ec8ea30263ea29c601ad47f3c537abc0ba0232ab5375e85534ce067","contract":["browserslist.findConfig(dir) discovers .browserslistrc files and returns structured section mappings","browserslist.findConfig(dir) discovers package.json browserslist array configurations and wraps them under defaults","browserslist.findConfig(dir) discovers package.json browserslist object configurations without adding defaults","browserslist.findConfig(dir) returns undefined when no configuration file exists in the directory tree"],"goal":"verify browserslist.findConfig in pkg:npm/browserslist@4.28.7","kind":"HOW","packages":["pkg:npm/browserslist@4.28.7"],"schemaVersion":1,"symbols":["browserslist.findConfig"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/browserslist@4.28.7"],"schemaVersion":1,"subject":"pkg:npm/browserslist@4.28.7","symbols":["browserslist.findConfig"],"verifierAdapter":"node-typescript@1"}
{
"name": "verify-browserslist-findconfig",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "verify-browserslist-findconfig",
"version": "1.0.0",
"dependencies": {
"browserslist": "4.28.7"
}
},
"node_modules/baseline-browser-mapping": {
"version": "2.11.24",
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.24.tgz",
"integrity": "sha512-hYrgxie335U08WqICoGqKRzV1HFXv6zdxwJE4ekCb80CM9a0SVVsN4QPwT67RraRo+9h8IATk6uxHJw7QSkdOg==",
"license": "Apache-2.0",
"bin": {
"baseline-browser-mapping": "dist/cli.cjs"
},
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/browserslist": {
"version": "4.28.7",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.7.tgz",
"integrity": "sha512-JxV13hNrFxqjOc8alRbq9dK1MM79NEXYpma2B2J4wAtpWS5zIEIKqWPGCl7N4o7Uc7B7itylh7SuDujATRyyTw==",
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/browserslist"
},
{
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/browserslist"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"dependencies": {
"baseline-browser-mapping": "^2.10.44",
"caniuse-lite": "^1.0.30001806",
"electron-to-chromium": "^1.5.393",
"node-releases": "^2.0.51",
"update-browserslist-db": "^1.2.3"
},
"bin": {
"browserslist": "cli.js"
},
"engines": {
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001810",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz",
"integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==",
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/browserslist"
},
{
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/caniuse-lite"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "CC-BY-4.0"
},
"node_modules/electron-to-chromium": {
"version": "1.5.430",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.430.tgz",
"integrity": "sha512-e1QEj72Y4zd8RlNZVmoTg+iCOSVwpk05IOiiQwdrkwCSVlZfPthevErhE+nckGd2YbsXfp1SkisznhGVIXP2NQ==",
"license": "ISC"
},
"node_modules/escalade": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
"integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/node-releases": {
"version": "2.0.55",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.55.tgz",
"integrity": "sha512-mIrE/Cw9y+9Au6dS5vDKDhQza9YvG6w+ZrS6X+ZzA7yFW/soAeaups4Qzn1bL6g5FVy8WtP79+0j82oPIbqRjQ==",
"license": "MIT",
"engines": {
"node": ">=18"
}
},
"node_modules/picocolors": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
"license": "ISC"
},
"node_modules/update-browserslist-db": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.3.tgz",
"integrity": "sha512-pJ2sYawQS0R/WI928Gj5GlPhTGzbMelq0+4INtSYNDV9ErKJcX6xjGWkoG/VnB3dpUm00zALaqkrUD77pO5TDQ==",
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/browserslist"
},
{
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/browserslist"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"dependencies": {
"escalade": "^3.2.0",
"picocolors": "^1.1.1"
},
"bin": {
"update-browserslist-db": "cli.js"
},
"peerDependencies": {
"browserslist": ">= 4.21.0"
}
}
}
}
{
"name": "verify-browserslist-findconfig",
"version": "1.0.0",
"private": true,
"type": "module",
"dependencies": {
"browserslist": "4.28.7"
}
}
{
"schemaVersion": 1,
"goal": "verify browserslist.findConfig in pkg:npm/browserslist@4.28.7",
"kind": "HOW",
"packages": [
"pkg:npm/browserslist@4.28.7"
],
"symbols": [
"browserslist.findConfig"
]
}
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import os from 'node:os';
import browserslist from 'browserslist';
const tempBase = fs.mkdtempSync(path.join(os.tmpdir(), 'csx-browserslist-findconfig-'));
try {
const rcDir = path.join(tempBase, 'rc-project');
fs.mkdirSync(rcDir, { recursive: true });
fs.writeFileSync(
path.join(rcDir, '.browserslistrc'),
'[production]\nchrome >= 100\n\n[development]\nlast 1 chrome version\n'
);
const pkgArrayDir = path.join(tempBase, 'pkg-array-project');
fs.mkdirSync(pkgArrayDir, { recursive: true });
fs.writeFileSync(
path.join(pkgArrayDir, 'package.json'),
JSON.stringify({ browserslist: ['> 1%', 'not dead'] })
);
const pkgObjDir = path.join(tempBase, 'pkg-obj-project');
fs.mkdirSync(pkgObjDir, { recursive: true });
fs.writeFileSync(
path.join(pkgObjDir, 'package.json'),
JSON.stringify({
browserslist: {
production: ['> 0.5%'],
development: ['last 1 chrome version']
}
})
);
const emptyDir = path.join(tempBase, 'empty-project');
fs.mkdirSync(emptyDir, { recursive: true });
// 1. browserslist.findConfig(dir) discovers .browserslistrc files and returns structured section mappings
const foundRc = browserslist.findConfig(rcDir);
assert.deepStrictEqual(foundRc, {
defaults: [],
production: ['chrome >= 100'],
development: ['last 1 chrome version']
});
// 2. browserslist.findConfig(dir) discovers package.json browserslist array configurations and wraps them under defaults
const foundPkgArray = browserslist.findConfig(pkgArrayDir);
assert.deepStrictEqual(foundPkgArray, {
defaults: ['> 1%', 'not dead']
});
// 3. browserslist.findConfig(dir) discovers package.json browserslist object configurations without adding defaults
const foundPkgObj = browserslist.findConfig(pkgObjDir);
assert.deepStrictEqual(foundPkgObj, {
production: ['> 0.5%'],
development: ['last 1 chrome version']
});
// 4. browserslist.findConfig(dir) returns undefined when no configuration file exists in the directory tree
const foundNone = browserslist.findConfig(emptyDir);
assert.strictEqual(foundNone, undefined);
console.log('Contract passed successfully.');
} finally {
fs.rmSync(tempBase, { recursive: true, force: true });
}
Seeder d'origine
anonyme