istanbul-lib-processinfo is a foundational utility library within the Istanbul.js ecosystem, primarily designed to manage the `processinfo` folder utilized by NYC (Yet Another JavaScript Code Coverage Tool). It provides an API for creating and interacting with `ProcessInfo` objects, which represent data about individual processes, and a `ProcessDB` class for aggregating and managing collections of these files. Key functionalities include saving process information to disk, building hierarchical process trees, and merging coverage maps from multiple processes. The current stable version is 3.0.0, which notably requires Node.js 20 or 22+ due to dependency updates. While not explicitly tied to a strict release cadence, major versions are typically released to align with Node.js LTS cycles or significant internal architectural changes, making it a stable component for tools consuming NYC's coverage data. Its primary differentiator is its deep integration with NYC's internal data structures, offering a robust way to programmatically interact with coverage data across processes.
npm install istanbul-lib-processinfoVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to instantiate `ProcessDB` and `ProcessInfo`, simulate saving process data, build a process tree, and retrieve a coverage map, using mock NYC dependencies and temporary files.
Upgrade your Node.js environment to version 20 or 22 and above. Check your project's `package.json` for engine constraints and update your development and CI/CD environments accordingly.
Ensure that only a single, coordinated process is responsible for writing the `index.json` file. Implement appropriate synchronization mechanisms (e.g., file locks, semaphores) if multiple processes might attempt to write the index.
Always follow a sequence of `processDB.spawn()` and/or `processDB.expunge()` calls with a final `await processDB.writeIndex()` to re-synchronize the process information index on disk.
Ensure your project uses Node.js 20+ and convert your usage to ESM `import` statements. If a CommonJS context is unavoidable, you may need to dynamically `import()` the module or use an older version if available.
Update your Node.js environment to version 20 or 22 or newer. Use `nvm` or a similar tool to manage Node.js versions.
Ensure the directory supplied to `ProcessDB` constructor is correct and writable. If starting fresh or recovering, call `await processDB.writeIndex()` to create or overwrite the index file. Remember `writeIndex` is non-atomic.