
Security News
GitHub Actions Pricing Whiplash: Self-Hosted Actions Billing Change Postponed
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.
A modern, asynchronous Node.js API for c8.
c8 leverages Node.js built-in V8 JavaScript code coverage to produce Istanbul-compatible reports.
c8js offers a usable API to access all c8 commands programmatically in Node.js with JavaScript functions.
c8js is not a wrapper around the command line interface: it calls c8 library functions in the current thread instead of spawning an instrumenter process.
Use npm install:
npm i -D c8js
c8js exports the functions c8js (the default export), report, and checkCoverage, in place of the commands c8, c8 report, and c8 check-coverage respectively.
Additionally, c8js exports the function exec that just runs a command and saves V8 coverage data.
An important difference is that all c8js functions throw exceptions in situations where c8 commands would terminate the process with a nonzero exit code.
For detailed usage information, see the API documentation.
This will run mocha --check-leaks --timeout=10000 test/*.spec.js and produce html and text-summary coverage reports.
async function runMocha()
{
const { default: c8js } = await import('c8js');
await c8js
(
'node_modules/mocha/bin/mocha.js',
['--check-leaks', '--timeout=10000', 'test/*.spec.js'],
{ reporter: ['html', 'text-summary'] },
);
}
npxSimilar to the previous example, but uses npx to locate and run Mocha.
npx will download packages from the npm registry if necessary.
async function runMocha()
{
const { default: c8js, commands } = await import('c8js');
await c8js
(
commands.npx,
['mocha', '--check-leaks', '--timeout=10000', 'test/*.spec.js'],
{ reporter: ['html', 'text-summary'] },
);
}
npm testThis will run npm test with the default coverage options.
async function runTest()
{
const { default: c8js, commands } = await import('c8js');
await c8js(commands.npm, ['test']);
}
node --test (Node.js ≥ 18.1)Node.js 18.1 introduces the command line flag --test that launches the built-in Test runner.
The following function shows how to run node --test with default coverage options.
async function runTest()
{
const { default: c8js } = await import('c8js');
await c8js(process.execPath, ['--test']);
}
c8js requires Node.js 14 or later.
FAQs
A modern, asynchronous Node.js API for c8
The npm package c8js receives a total of 42 weekly downloads. As such, c8js popularity was classified as not popular.
We found that c8js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.