CodeVetter
← All unpacks
CodeVetter · Repo Unpack evidence

istanbuljs/nyc

Scanned commit 9086204751 dated 2026-05-17 — last upstream commit. Generated by codevetter 1.15.0 on 2026-10-02.

github.com/istanbuljs/nyc ↗ · 173 files · 240 KB

nyc Having problems? want to contribute? join our community slack.

Deep analysis by cli:codex via the codex CLI on 2026-10-02 (342s) — every claim below links to its cited source files. Source inspection; upstream code and tests were not executed.

Overview

nyc is Istanbul’s JavaScript coverage CLI for developers who want to run existing test commands, collect coverage across subprocesses, and enforce coverage thresholds. It instruments source through Node loading hooks or an offline instrument command, persists per-process coverage, then merges and remaps results into configurable reports. At commit 908620475199fa7b9ea0ea8b21d6d8ad6921e3ae, the package is version 18.0.0 and supports Node 20 or Node 22 and newer.

System map

The npm package contains a reusable NYC class, a CLI coordinator, child bootstrap modules, and four command handlers. Instrumentation, coverage merging, source-map transformation, reporting, and process indexing use separate Istanbul libraries. Runtime boundaries follow parent and child processes, with configuration propagated through environment variables and coverage exchanged through files. Packaging and CI describe an npm CLI distribution with generated self-coverage used during development.

Feature catalog

The primary interface wraps an existing executable or test runner to collect coverage. Users can control file selection, account for unloaded files, preload transpilers, and choose reports or threshold enforcement. Separate commands instrument source trees, regenerate reports, check stored coverage, and merge raw results. Source maps and documented external uploader workflows connect coverage to transpiled projects and hosted reporting services.

Data flow

Arguments and project configuration become an NYC configuration object before child execution. Environment variables carry that configuration and ancestry into child processes, while loading hooks transform eligible source into counter-bearing code. Counters become coverage JSON and process metadata at exit. Report and merge operations read these artifacts, recover source maps, combine counters, and produce reports, merged JSON, or failure status.

Behavior traces

The source supports ordered walkthroughs of command startup, child instrumentation, persistence and reporting, and offline instrumentation. These traces describe execution order and conditional branches rather than observed runs. Threshold checks and reporting differ in order between normal execution and the standalone report command. The --all and merge branches reuse core collection machinery while changing their input and output boundaries.

Testing signals

Tests and CI were inspected, not executed; test existence establishes intended checks, not passing results. TAP tests combine direct NYC calls, spawned CLI fixtures, and output snapshots. Development tests generally target generated self-coverage copies, with a separate coverage variable and exit writer. Coverage inspection is bounded, and explicit Windows branches and ignored error paths limit what the configured checks establish.

Risk map

The sensitive boundaries inspected are local module execution, environment propagation, process hooks, and filesystem operations. Findings below are source observations, not confirmed vulnerabilities. Coverage can become incomplete through permissive instrumentation failures or suppressed artifact-loading errors. Cleanup, tree copying, and global hook state deserve focused review because their effects extend beyond a single transformed file.

Extension points

Extensions enter through command modules, schema-derived options, configuration presets, preloaded modules, instrumenter factories, and reporter factories. NYC already centralizes the selection and transform pipeline, so additions should reuse those boundaries. Some extension contracts depend on external packages rather than a repository-local registry. Command dispatch and cache invalidation require coordinated changes across multiple files.

Contributor handoff

Begin with the CLI/core boundary and the generated self-coverage test setup before making changes. Keep configuration, argument routing, source selection, subprocess ancestry, and report remapping consistent. Tests and CI were inspected, not executed, and this brief is a bounded source investigation rather than exhaustive verification. Future checks should use existing npm/TAP machinery only when execution is authorized, with particular care around cleanup and source-mutating fixtures.

Languages

LanguageFilesShare of source
JavaScript11999%
JSON24docs/config
Markdown7docs/config
YAML6docs/config
TypeScript11%

Start reading here

Probable source entrypoint: index.js — inferred from the directory tree and manifest, not the upstream docs.

Source roots

lib/ (14 files)

Source layout — lib/

PathFiles
lib/commands/5
lib/instrumenters/2
lib/config-util.js1
lib/fs-promises.js1
lib/hash.js1
lib/process-args.js1
lib/register-env.js1
lib/source-maps.js1
lib/wrap.js1

Repository structure

Top-level pathFiles
test/129
lib/14
tap-snapshots/5
.github/4
docs/4
bin/2

Docs found: README.mddocs/instrument.mddocs/profiling.mddocs/setup-codecov.mddocs/setup-coveralls.md

Package

package.json — nyc v18.0.0, 36 declared dependencies.

@istanbuljs/load-nyc-config@istanbuljs/schemaany-pathcaching-transformconvert-source-mapdecamelizefind-cache-dirfind-upforeground-childget-package-typeglobis-windows

CI & config entrypoints

Structural health signals

Average score 9.7/10 across 96 analyzed source files; 1 hotspot surfaced.

These are deterministic review leads — size, churn, and structural signals — not proof of a bug in this project.

Recent history