CodeSampleX

Sample

@types/istanbul-lib-coverage 2.0.6

Verified sample for npm @types/istanbul-lib-coverage 2.0.6. The contract ran on node 22 · linux alpine/x64 · docker and passed.

sha256:e9d7ddd8cc312859b0a67d1673db033a400fa0e661ef6ee1fe240107ac139103

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 node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

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 pkg:npm/%40types/istanbul-lib-coverage@2.0.6
Packages
Environment
node 22.23.2
Created
2026-08-21T05:32:28Z

Contract

  1. package manifest specifies index.d.ts type declarations and TypeScript version
  2. declares CoverageSummary class and CoverageSummaryData interface for summary statistics
  3. declares CoverageMap class and CoverageMapData interface with coverage aggregation methods
  4. declares FileCoverage class and FileCoverageData interface with line and branch calculation methods
  5. declares createCoverageMap, createCoverageSummary, and createFileCoverage factory functions

Files

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

Download the source artifact (tar.gz)

Source

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/%40types/istanbul-lib-coverage@2.0.6
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40types/istanbul-lib-coverage@2.0.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:28c93f9d41106714403819d77392b04ade5a8cba8e0cde3be8be32b310c0d736","constraints":{"executionContext":"node"},"contract":["package manifest specifies index.d.ts type declarations and TypeScript version","declares CoverageSummary class and CoverageSummaryData interface for summary statistics","declares CoverageMap class and CoverageMapData interface with coverage aggregation methods","declares FileCoverage class and FileCoverageData interface with line and branch calculation methods","declares createCoverageMap, createCoverageSummary, and createFileCoverage factory functions"],"goal":"verify pkg:npm/%40types/istanbul-lib-coverage@2.0.6","kind":"HOW","packages":["pkg:npm/%40types/istanbul-lib-coverage@2.0.6"],"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/%40types/istanbul-lib-coverage@2.0.6"],"schemaVersion":1,"subject":"pkg:npm/%40types/istanbul-lib-coverage@2.0.6","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-types-istanbul-lib-coverage",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-types-istanbul-lib-coverage",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@types/istanbul-lib-coverage": "2.0.6"
      }
    },
    "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"
    }
  }
}
package.json
{
  "name": "sample-types-istanbul-lib-coverage",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "license": "MIT-0",
  "dependencies": {
    "@types/istanbul-lib-coverage": "2.0.6"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40types/istanbul-lib-coverage@2.0.6",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40types/istanbul-lib-coverage@2.0.6"
  ],
  "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 @types/istanbul-lib-coverage package manifest and verify type declaration entry points
const pkgPath = require.resolve('@types/istanbul-lib-coverage/package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));

assert.equal(pkg.name, '@types/istanbul-lib-coverage', 'Package name must be @types/istanbul-lib-coverage');
assert.equal(pkg.version, '2.0.6', 'Package version must be 2.0.6');
assert.equal(pkg.types, 'index.d.ts', 'Package types entry must point to index.d.ts');
assert.equal(pkg.typeScriptVersion, '4.5', 'TypeScript version must be 4.5');

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

// 2. Verify CoverageSummary class and CoverageSummaryData interface for summary statistics
assert.ok(
  dtsContent.includes('export interface CoverageSummaryData {') &&
  dtsContent.includes('lines: Totals;') &&
  dtsContent.includes('statements: Totals;') &&
  dtsContent.includes('branches: Totals;') &&
  dtsContent.includes('functions: Totals;'),
  'CoverageSummaryData interface must declare lines, statements, branches, and functions totals'
);
assert.ok(
  dtsContent.includes('export class CoverageSummary {') &&
  dtsContent.includes('constructor(data: CoverageSummary | CoverageSummaryData);') &&
  dtsContent.includes('merge(obj: CoverageSummary): CoverageSummary;') &&
  dtsContent.includes('toJSON(): CoverageSummaryData;') &&
  dtsContent.includes('isEmpty(): boolean;'),
  'CoverageSummary class must declare constructor, merge, toJSON, and isEmpty methods'
);

// 3. Verify CoverageMap class and CoverageMapData interface with coverage aggregation methods
assert.ok(
  dtsContent.includes('export interface CoverageMapData {') &&
  dtsContent.includes('[key: string]: FileCoverage | FileCoverageData;'),
  'CoverageMapData interface must map keys to FileCoverage or FileCoverageData'
);
assert.ok(
  dtsContent.includes('export class CoverageMap {') &&
  dtsContent.includes('constructor(data: CoverageMapData | CoverageMap);') &&
  dtsContent.includes('addFileCoverage(pathOrObject: string | FileCoverage | FileCoverageData): void;') &&
  dtsContent.includes('files(): string[];') &&
  dtsContent.includes('fileCoverageFor(filename: string): FileCoverage;') &&
  dtsContent.includes('filter(callback: (key: string) => boolean): void;') &&
  dtsContent.includes('getCoverageSummary(): CoverageSummary;') &&
  dtsContent.includes('merge(data: CoverageMapData | CoverageMap): void;') &&
  dtsContent.includes('toJSON(): CoverageMapData;'),
  'CoverageMap class must declare constructor, addFileCoverage, files, fileCoverageFor, filter, getCoverageSummary, and merge methods'
);

// 4. Verify FileCoverage class, FileCoverageData, Location, Range, BranchMapping, FunctionMapping, and Totals
assert.ok(
  dtsContent.includes('export interface Location {') &&
  dtsContent.includes('export interface Range {') &&
  dtsContent.includes('export interface BranchMapping {') &&
  dtsContent.includes('export interface FunctionMapping {') &&
  dtsContent.includes('export interface Totals {') &&
  dtsContent.includes('export interface Coverage {'),
  'Location, Range, BranchMapping, FunctionMapping, Totals, and Coverage interfaces must be declared'
);
assert.ok(
  dtsContent.includes('export interface FileCoverageData {') &&
  dtsContent.includes('path: string;') &&
  dtsContent.includes('statementMap: { [key: string]: Range };') &&
  dtsContent.includes('fnMap: { [key: string]: FunctionMapping };') &&
  dtsContent.includes('branchMap: { [key: string]: BranchMapping };') &&
  dtsContent.includes('s: { [key: string]: number };') &&
  dtsContent.includes('f: { [key: string]: number };') &&
  dtsContent.includes('b: { [key: string]: number[] };'),
  'FileCoverageData interface must declare path, statementMap, fnMap, branchMap, s, f, and b'
);
assert.ok(
  dtsContent.includes('export class FileCoverage implements FileCoverageData {') &&
  dtsContent.includes('constructor(data: string | FileCoverage | FileCoverageData);') &&
  dtsContent.includes('merge(other: FileCoverageData): void;') &&
  dtsContent.includes('getBranchCoverageByLine(): { [line: number]: Coverage };') &&
  dtsContent.includes('getLineCoverage(): { [line: number]: number };') &&
  dtsContent.includes('getUncoveredLines(): number[];') &&
  dtsContent.includes('resetHits(): void;') &&
  dtsContent.includes('computeBranchTotals(): Totals;') &&
  dtsContent.includes('computeSimpleTotals(): Totals;') &&
  dtsContent.includes('toSummary(): CoverageSummary;') &&
  dtsContent.includes('toJSON(): object;'),
  'FileCoverage class must implement FileCoverageData with line, branch, summary, and hit calculation methods'
);

// 5. Verify factory functions and exported classes object
assert.ok(
  dtsContent.includes('export const classes: {') &&
  dtsContent.includes('FileCoverage: FileCoverage;'),
  'classes object must declare FileCoverage property'
);
assert.ok(
  dtsContent.includes('export function createCoverageMap(data?: CoverageMap | CoverageMapData): CoverageMap;') &&
  dtsContent.includes('export function createCoverageSummary(obj?: CoverageSummary | CoverageSummaryData): CoverageSummary;') &&
  dtsContent.includes('export function createFileCoverage(pathOrObject: string | FileCoverage | FileCoverageData): FileCoverage;'),
  'Factory functions createCoverageMap, createCoverageSummary, and createFileCoverage must be declared'
);

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

Origin Seeder

anonymous