CodeSampleX

Ejemplo

@jest/types 29.6.3

Muestra verificada para npm @jest/types 29.6.3. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: package manifest specifies main and…

sha256:6a9c12f24d74b89aa7258a88fd9d63ce14b7b07e3eb5ed411ddc42f7c0601939

Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido. Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas. MIT-0

Evidencia de ejecución

El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.

Base de evidencia
Contrato firmado aprobado
Recibos de verificación
1
Claves de firma que lo compilaron
1
Entorno declarado node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Entornos de las ejecuciones de verificación

Entorno Contrato Etapas Ejecución
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

Caso

HOW
Objetivo
verify pkg:npm/%40jest/types@29.6.3
Paquetes
Entorno
node 22.23.2
Creado
2026-08-27T15:23:46Z

Contrato

  1. package manifest specifies main and types entry points and exports map for index.d.ts
  2. declares Circus namespace containing event types, test runner state, describe blocks, hooks, and test entries
  3. declares Config namespace with InitialOptions, ProjectConfig, GlobalConfig, and Argv type definitions
  4. declares Global namespace with TestFrameworkGlobals, GlobalAdditions, Describe, and It function interfaces
  5. declares TestResult and TransformTypes namespaces with test outcome and code transformation types

Archivos

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs

Descargar el artefacto de código fuente (tar.gz)

Código fuente

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/%40jest/types@29.6.3
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40jest/types@29.6.3
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:f642f95366b841ee34afca18c3d9c461c74b00efb6b1bc92647334d4a24c1800","constraints":{"executionContext":"node"},"contract":["package manifest specifies main and types entry points and exports map for index.d.ts","declares Circus namespace containing event types, test runner state, describe blocks, hooks, and test entries","declares Config namespace with InitialOptions, ProjectConfig, GlobalConfig, and Argv type definitions","declares Global namespace with TestFrameworkGlobals, GlobalAdditions, Describe, and It function interfaces","declares TestResult and TransformTypes namespaces with test outcome and code transformation types"],"goal":"verify pkg:npm/%40jest/types@29.6.3","kind":"HOW","packages":["pkg:npm/%40jest/types@29.6.3"],"schemaVersion":1},"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/%40jest/types@29.6.3"],"schemaVersion":1,"subject":"pkg:npm/%40jest/types@29.6.3","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-jest-types",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-jest-types",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@jest/types": "29.6.3"
      }
    },
    "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/@jest/types": {
      "version": "29.6.3",
      "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz",
      "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==",
      "license": "MIT",
      "dependencies": {
        "@jest/schemas": "^29.6.3",
        "@types/istanbul-lib-coverage": "^2.0.0",
        "@types/istanbul-reports": "^3.0.0",
        "@types/node": "*",
        "@types/yargs": "^17.0.8",
        "chalk": "^4.0.0"
      },
      "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/@types/istanbul-lib-coverage": {
      "version": "2.0.6",
      "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz",
      "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==",
      "license": "MIT"
    },
    "node_modules/@types/istanbul-lib-report": {
      "version": "3.0.3",
      "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz",
      "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==",
      "license": "MIT",
      "dependencies": {
        "@types/istanbul-lib-coverage": "*"
      }
    },
    "node_modules/@types/istanbul-reports": {
      "version": "3.0.4",
      "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz",
      "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==",
      "license": "MIT",
      "dependencies": {
        "@types/istanbul-lib-report": "*"
      }
    },
    "node_modules/@types/node": {
      "version": "26.4.0",
      "resolved": "https://registry.npmjs.org/@types/node/-/node-26.4.0.tgz",
      "integrity": "sha512-faiGnoIrLH/V8cibOMEAZ8pMw6oXqSukl29ra4mN8GdaB2ZewzeaLj+INpV5N+Z1eKWzY+IzaIZH2EIR6YZRNQ==",
      "license": "MIT",
      "dependencies": {
        "undici-types": "~8.3.0"
      }
    },
    "node_modules/@types/yargs": {
      "version": "17.0.35",
      "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.35.tgz",
      "integrity": "sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg==",
      "license": "MIT",
      "dependencies": {
        "@types/yargs-parser": "*"
      }
    },
    "node_modules/@types/yargs-parser": {
      "version": "21.0.3",
      "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz",
      "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==",
      "license": "MIT"
    },
    "node_modules/ansi-styles": {
      "version": "4.3.0",
      "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
      "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
      "license": "MIT",
      "dependencies": {
        "color-convert": "^2.0.1"
      },
      "engines": {
        "node": ">=8"
      },
      "funding": {
        "url": "https://github.com/chalk/ansi-styles?sponsor=1"
      }
    },
    "node_modules/chalk": {
      "version": "4.1.2",
      "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
      "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
      "license": "MIT",
      "dependencies": {
        "ansi-styles": "^4.1.0",
        "supports-color": "^7.1.0"
      },
      "engines": {
        "node": ">=10"
      },
      "funding": {
        "url": "https://github.com/chalk/chalk?sponsor=1"
      }
    },
    "node_modules/color-convert": {
      "version": "2.0.1",
      "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
      "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
      "license": "MIT",
      "dependencies": {
        "color-name": "~1.1.4"
      },
      "engines": {
        "node": ">=7.0.0"
      }
    },
    "node_modules/color-name": {
      "version": "1.1.4",
      "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
      "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
      "license": "MIT"
    },
    "node_modules/has-flag": {
      "version": "4.0.0",
      "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
      "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
      "license": "MIT",
      "engines": {
        "node": ">=8"
      }
    },
    "node_modules/supports-color": {
      "version": "7.2.0",
      "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
      "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
      "license": "MIT",
      "dependencies": {
        "has-flag": "^4.0.0"
      },
      "engines": {
        "node": ">=8"
      }
    },
    "node_modules/undici-types": {
      "version": "8.3.0",
      "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz",
      "integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==",
      "license": "MIT"
    }
  }
}
package.json
{
  "name": "sample-jest-types",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "license": "MIT-0",
  "dependencies": {
    "@jest/types": "29.6.3"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40jest/types@29.6.3",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40jest/types@29.6.3"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.mjs
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
import fs from 'node:fs';
import path from 'node:path';

const require = createRequire(import.meta.url);

// 1. Resolve @jest/types package manifest and verify exports & entry points
const pkgPath = require.resolve('@jest/types/package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));

assert.equal(pkg.name, '@jest/types', 'Package name must be @jest/types');
assert.equal(pkg.version, '29.6.3', 'Package version must be 29.6.3');
assert.equal(pkg.main, './build/index.js', 'Package main entry must point to ./build/index.js');
assert.equal(pkg.types, './build/index.d.ts', 'Package types entry must point to ./build/index.d.ts');
assert.ok(pkg.exports && pkg.exports['.'], 'Package exports must define root export');
assert.equal(pkg.exports['.'].types, './build/index.d.ts', 'Exports types entry must point to ./build/index.d.ts');
assert.equal(pkg.exports['.'].default, './build/index.js', 'Exports default entry must point to ./build/index.js');

const typesDir = path.dirname(pkgPath);
const dtsContent = fs.readFileSync(path.join(typesDir, 'build/index.d.ts'), 'utf8');

// 2. Verify Circus namespace declaring event types, test runner state, describe blocks, hooks, and test entries
assert.ok(
  dtsContent.includes('declare namespace Circus {') &&
  dtsContent.includes('export {Circus};'),
  'Circus namespace must be declared and exported'
);
assert.ok(
  dtsContent.includes('declare type AsyncEvent =') &&
  dtsContent.includes("name: 'hook_start';") &&
  dtsContent.includes("name: 'test_fn_start';") &&
  dtsContent.includes("name: 'run_start';") &&
  dtsContent.includes('declare type SyncEvent ='),
  'AsyncEvent and SyncEvent types must be declared for Circus runner'
);
assert.ok(
  dtsContent.includes('State,') &&
  dtsContent.includes('DescribeBlock,') &&
  dtsContent.includes('TestEntry,') &&
  dtsContent.includes('Hook,'),
  'Circus namespace must export State, DescribeBlock, TestEntry, and Hook'
);

// 3. Verify Config namespace with InitialOptions, ProjectConfig, GlobalConfig, and Argv type definitions
assert.ok(
  dtsContent.includes('declare namespace Config {') &&
  dtsContent.includes('export {Config};'),
  'Config namespace must be declared and exported'
);
assert.ok(
  dtsContent.includes('InitialOptions,') &&
  dtsContent.includes('ProjectConfig,') &&
  dtsContent.includes('GlobalConfig,') &&
  dtsContent.includes('Argv,') &&
  dtsContent.includes('DefaultOptions,'),
  'Config namespace must export InitialOptions, ProjectConfig, GlobalConfig, Argv, and DefaultOptions'
);
assert.ok(
  dtsContent.includes('declare type InitialOptions =') &&
  dtsContent.includes('declare type ProjectConfig =') &&
  dtsContent.includes('declare type GlobalConfig =') &&
  dtsContent.includes('declare type Argv ='),
  'InitialOptions, ProjectConfig, GlobalConfig, and Argv types must be declared'
);

// 4. Verify Global namespace with TestFrameworkGlobals, GlobalAdditions, Describe, and It function interfaces
assert.ok(
  dtsContent.includes('declare namespace Global {') &&
  dtsContent.includes('export {Global};'),
  'Global namespace must be declared and exported'
);
assert.ok(
  dtsContent.includes('declare interface GlobalAdditions extends TestFrameworkGlobals') &&
  dtsContent.includes('__coverage__: CoverageMapData;'),
  'GlobalAdditions interface must extend TestFrameworkGlobals and declare __coverage__'
);
assert.ok(
  dtsContent.includes('declare interface Describe extends DescribeBase') &&
  dtsContent.includes('declare interface It extends ItBase'),
  'Describe and It interfaces must extend base test runner interfaces'
);

// 5. Verify TestResult and TransformTypes namespaces with test outcome and code transformation types
assert.ok(
  dtsContent.includes('declare namespace TestResult {') &&
  dtsContent.includes('export {TestResult};') &&
  dtsContent.includes('declare namespace TransformTypes {') &&
  dtsContent.includes('export {TransformTypes};'),
  'TestResult and TransformTypes namespaces must be declared and exported'
);
assert.ok(
  dtsContent.includes('declare type AssertionResult = {') &&
  dtsContent.includes('ancestorTitles: Array<string>;') &&
  dtsContent.includes('failureMessages: Array<string>;') &&
  dtsContent.includes('status: Status;'),
  'AssertionResult type must declare ancestorTitles, failureMessages, and status fields'
);
assert.ok(
  dtsContent.includes('declare type TransformResult = {') &&
  dtsContent.includes('code: string;') &&
  dtsContent.includes('originalCode: string;') &&
  dtsContent.includes('sourceMapPath: string | null;'),
  'TransformResult type must declare code, originalCode, and sourceMapPath fields'
);

console.log('Contract tests passed successfully.');

Seeder de origen

anónimo