CodeSampleX

サンプル

@istanbuljs/schema 0.1.6

検証済みサンプル — npm @istanbuljs/schema 0.1.6. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: defaults.nyc exposes standard default configuration…

sha256:3f24ac36ac673344167fce1c2581ed2783f3108731219723687cfbf89c28d84e

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
1
ビルドした署名鍵
1
宣言された環境 node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

検証実行環境

環境 コントラクト ステージ 実行日
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-27

ケース

HOW
ゴール
verify pkg:npm/%40istanbuljs/schema@0.1.6
パッケージ
環境
node 22.23.2
作成日
2026-08-27T21:27:49Z

コントラクト

  1. defaults.nyc exposes standard default configuration options including default exclude patterns, supported file extensions, and coverage settings
  2. defaults.testExclude provides default exclusion patterns and supported extensions (.js, .cjs, .mjs, .ts, .tsx, .jsx)
  3. defaults.instrumentVisitor provides default coverage variable names and global scope settings
  4. defaults.instrumenter combines visitor and parser generator defaults including babel parser plugins
  5. schema objects (nyc, testExclude, babelPluginIstanbul, instrumentVisitor, instrumenter) expose json-schema property definitions with types and descriptions
  6. defaults getters dynamically evaluate cwd property from process.cwd() and return isolated array instances

ファイル

  • PROMPT.md
  • csx.json
  • index.js
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.cjs

ソースアーティファクトをダウンロード (tar.gz)

ソース

PROMPT.md
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/%40istanbuljs/schema@0.1.6
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40istanbuljs/schema@0.1.6
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - packageManager: npm@10.9.8
  - runtime: node@22.23.2

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.
csx.json
{"case":{"caseId":"case:sha256:e72931ac472ac329584fc2723c4ff0389cc27f88f9c55b3ce391ecba10c11b80","constraints":{"executionContext":"node"},"contract":["defaults.nyc exposes standard default configuration options including default exclude patterns, supported file extensions, and coverage settings","defaults.testExclude provides default exclusion patterns and supported extensions (.js, .cjs, .mjs, .ts, .tsx, .jsx)","defaults.instrumentVisitor provides default coverage variable names and global scope settings","defaults.instrumenter combines visitor and parser generator defaults including babel parser plugins","schema objects (nyc, testExclude, babelPluginIstanbul, instrumentVisitor, instrumenter) expose json-schema property definitions with types and descriptions","defaults getters dynamically evaluate cwd property from process.cwd() and return isolated array instances"],"goal":"verify pkg:npm/%40istanbuljs/schema@0.1.6","kind":"HOW","packages":["pkg:npm/%40istanbuljs/schema@0.1.6"],"schemaVersion":1},"contractCommand":["node","test/contract.cjs"],"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/%40istanbuljs/schema@0.1.6"],"schemaVersion":1,"subject":"pkg:npm/%40istanbuljs/schema@0.1.6","verifierAdapter":"node-typescript@1"}
index.js
'use strict';

const schema = require('@istanbuljs/schema');

function getNycDefaults() {
  return schema.defaults.nyc;
}

function getTestExcludeDefaults() {
  return schema.defaults.testExclude;
}

function getInstrumentVisitorDefaults() {
  return schema.defaults.instrumentVisitor;
}

function getInstrumenterDefaults() {
  return schema.defaults.instrumenter;
}

function getSchema(name) {
  return schema[name];
}

module.exports = {
  schema,
  getNycDefaults,
  getTestExcludeDefaults,
  getInstrumentVisitorDefaults,
  getInstrumenterDefaults,
  getSchema
};
package-lock.json
{
  "name": "sample-istanbuljs-schema",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-istanbuljs-schema",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@istanbuljs/schema": "0.1.6"
      }
    },
    "node_modules/@istanbuljs/schema": {
      "version": "0.1.6",
      "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.6.tgz",
      "integrity": "sha512-+Sg6GCR/wy1oSmQDFq4LQDAhm3ETKnorxN+y5nbLULOR3P0c14f2Wurzj3/xqPXtasLFfHd5iRFQ7AJt4KH2cw==",
      "license": "MIT",
      "engines": {
        "node": ">=8"
      }
    }
  }
}
package.json
{
  "name": "sample-istanbuljs-schema",
  "version": "1.0.0",
  "private": true,
  "description": "verify pkg:npm/@istanbuljs/schema@0.1.6",
  "main": "index.js",
  "scripts": {
    "test": "node test/contract.cjs"
  },
  "dependencies": {
    "@istanbuljs/schema": "0.1.6"
  },
  "license": "MIT-0"
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40istanbuljs/schema@0.1.6",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40istanbuljs/schema@0.1.6"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.cjs
'use strict';

const assert = require('assert');
const schema = require('@istanbuljs/schema');
const {
  getNycDefaults,
  getTestExcludeDefaults,
  getInstrumentVisitorDefaults,
  getInstrumenterDefaults,
  getSchema
} = require('../index.js');

async function run() {
  // 1. defaults.nyc exposes standard default configuration options including default exclude patterns, supported file extensions, and coverage settings
  const nycDefaults = getNycDefaults();
  assert(Array.isArray(nycDefaults.exclude), 'defaults.nyc.exclude must be an array');
  assert(nycDefaults.exclude.includes('coverage/**'), 'defaults.nyc.exclude must include coverage/**');
  assert(nycDefaults.exclude.includes('**/*.d.ts'), 'defaults.nyc.exclude must include **/*.d.ts');
  assert(nycDefaults.exclude.includes('test{,s}/**'), 'defaults.nyc.exclude must include test{,s}/**');
  assert(nycDefaults.exclude.includes('**/__tests__/**'), 'defaults.nyc.exclude must include **/__tests__/**');

  assert(Array.isArray(nycDefaults.extension), 'defaults.nyc.extension must be an array');
  assert.deepStrictEqual(
    nycDefaults.extension,
    ['.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx'],
    'defaults.nyc.extension must match expected list of JavaScript and TypeScript extensions'
  );

  assert.strictEqual(nycDefaults.tempDir, './.nyc_output', 'defaults.nyc.tempDir default must be ./.nyc_output');
  assert.strictEqual(nycDefaults.lines, 90, 'defaults.nyc.lines default must be 90');
  assert(Array.isArray(nycDefaults.reporter) && nycDefaults.reporter.includes('text'), 'defaults.nyc.reporter must default to ["text"]');
  assert.strictEqual(nycDefaults.clean, true, 'defaults.nyc.clean must be true');
  assert.strictEqual(nycDefaults.instrument, true, 'defaults.nyc.instrument must be true');
  assert.strictEqual(nycDefaults.sourceMap, true, 'defaults.nyc.sourceMap must be true');

  // 2. defaults.testExclude provides default exclusion patterns and supported extensions (.js, .cjs, .mjs, .ts, .tsx, .jsx)
  const testExcludeDefaults = getTestExcludeDefaults();
  assert.strictEqual(testExcludeDefaults.excludeNodeModules, true, 'defaults.testExclude.excludeNodeModules must be true');
  assert(Array.isArray(testExcludeDefaults.include) && testExcludeDefaults.include.length === 0, 'defaults.testExclude.include must default to empty array');
  assert.deepStrictEqual(testExcludeDefaults.extension, nycDefaults.extension, 'defaults.testExclude.extension must match standard extensions');
  assert(testExcludeDefaults.exclude.includes('coverage/**'), 'defaults.testExclude.exclude must include default exclude patterns');

  // 3. defaults.instrumentVisitor provides default coverage variable names and global scope settings
  const visitorDefaults = getInstrumentVisitorDefaults();
  assert.strictEqual(visitorDefaults.coverageVariable, '__coverage__', 'defaults.instrumentVisitor.coverageVariable must be __coverage__');
  assert.strictEqual(visitorDefaults.coverageGlobalScope, 'this', 'defaults.instrumentVisitor.coverageGlobalScope must be this');
  assert.strictEqual(visitorDefaults.coverageGlobalScopeFunc, true, 'defaults.instrumentVisitor.coverageGlobalScopeFunc must be true');
  assert(Array.isArray(visitorDefaults.ignoreClassMethods) && visitorDefaults.ignoreClassMethods.length === 0, 'defaults.instrumentVisitor.ignoreClassMethods must default to empty array');

  // 4. defaults.instrumenter combines visitor and parser generator defaults including babel parser plugins
  const instrumenterDefaults = getInstrumenterDefaults();
  assert.strictEqual(instrumenterDefaults.autoWrap, true, 'defaults.instrumenter.autoWrap must be true');
  assert.strictEqual(instrumenterDefaults.esModules, true, 'defaults.instrumenter.esModules must be true');
  assert.strictEqual(instrumenterDefaults.compact, true, 'defaults.instrumenter.compact must be true');
  assert.strictEqual(instrumenterDefaults.preserveComments, true, 'defaults.instrumenter.preserveComments must be true');
  assert.strictEqual(instrumenterDefaults.produceSourceMap, true, 'defaults.instrumenter.produceSourceMap must be true');
  assert(Array.isArray(instrumenterDefaults.parserPlugins), 'defaults.instrumenter.parserPlugins must be an array');
  const expectedPlugins = ['asyncGenerators', 'bigInt', 'classProperties', 'dynamicImport', 'topLevelAwait'];
  for (const plugin of expectedPlugins) {
    assert(instrumenterDefaults.parserPlugins.includes(plugin), `defaults.instrumenter.parserPlugins must include ${plugin}`);
  }

  // 5. schema objects (nyc, testExclude, babelPluginIstanbul, instrumentVisitor, instrumenter) expose json-schema property definitions with types and descriptions
  const schemaNames = ['nyc', 'testExclude', 'babelPluginIstanbul', 'instrumentVisitor', 'instrumenter'];
  for (const name of schemaNames) {
    const s = getSchema(name);
    assert(s, `schema.${name} must exist`);
    assert.strictEqual(s.type, 'object', `schema.${name}.type must be object`);
    assert(typeof s.description === 'string' && s.description.length > 0, `schema.${name}.description must be non-empty`);
    assert(typeof s.properties === 'object', `schema.${name}.properties must be an object`);
  }
  assert.strictEqual(schema.nyc.properties.exclude.type, 'array', 'schema.nyc.properties.exclude.type must be array');
  assert.strictEqual(schema.nyc.properties.exclude.nycAlias, 'x', 'schema.nyc.properties.exclude.nycAlias must be x');
  assert.strictEqual(schema.nyc.properties.tempDir.default, './.nyc_output', 'schema.nyc.properties.tempDir.default must be ./.nyc_output');

  // 6. defaults getters dynamically evaluate cwd property from process.cwd() and return isolated array instances
  assert.strictEqual(nycDefaults.cwd, process.cwd(), 'defaults.nyc.cwd must match current working directory');
  assert.strictEqual(testExcludeDefaults.cwd, process.cwd(), 'defaults.testExclude.cwd must match current working directory');

  const initialExcludeLen = schema.defaults.nyc.exclude.length;
  const copy1 = schema.defaults.nyc;
  copy1.exclude.push('temporary-sentinel-pattern');
  const copy2 = schema.defaults.nyc;
  assert.strictEqual(
    copy2.exclude.length,
    initialExcludeLen,
    'schema.defaults getter must return a fresh copy of array properties'
  );

  console.log('Contract assertions passed successfully.');
}

run().catch((err) => {
  console.error('Contract test failed:', err);
  process.exit(1);
});

オリジンシーダー

匿名