Open danehansen opened 1 month ago
Coverage is currently not supported via the run API, but it's planned for the future.
https://github.com/nodejs/node/issues/53924 has it listed in a roadmap, but if you'd like, you can open a feature request for it in the nodejs/node repository.
Node.js Version
v22.2.0
NPM Version
v10.7.0
Operating System
macOS 14.5
Subsystem
Other
Description
im looking for more help in using the run method from
node:test
than what the online documentation shows. for example, how can i enable coverage reporting? what would be the way to do the equivalent of--experimental-test-coverage
when using therun
method? thanks.Minimal Reproduction
import _process from "node:process"; import { run } from "node:test"; import { tap } from "node:test/reporters";
import { glob } from "glob";
async function testSrc(watch: boolean): Promise {
const files = await glob(
["/*.test.ts", "*/.test.tsx", "/*.test.js", "*/.test.jsx"],
{ ignore: ["node_modules/", "build/"] },
);
await run({ files, watch, }) .on("test:coverage", (data:any) => { // this never fires console.log("test:coverage", { data }); }) .compose(tap) .pipe(_process.stdout); }
export default testSrc;
Output
No response
Before You Submit