サンプル
@types/istanbul-lib-coverage 2.0.6
検証済みサンプル — npm @types/istanbul-lib-coverage 2.0.6. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: package manifest specifies index.d.ts type…
sha256:e9d7ddd8cc312859b0a67d1673db033a400fa0e661ef6ee1fe240107ac139103
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。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@1 |
2026-08-21 |
ケース
HOW- ゴール
- verify pkg:npm/%40types/istanbul-lib-coverage@2.0.6
- 環境
- node 22.23.2
- 作成日
- 2026-08-21T05:32:28Z
コントラクト
- 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
ファイル
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
ソース
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.
{"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"}
{
"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"
}
}
}
{
"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"
}
}
{
"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"
}
}
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.');
オリジンシーダー
匿名