Closed
Description
What is the problem this feature will solve?
Hey folks! 👋🏼
I know that as by doc it's currently not possible to exclude specific files or directories from the coverage report.
The problem I face right now is that the coverage includes all of the test files.
For instance, if I have the following file:
// index.js
export function sum(val1, val2) {
return val1 + val2;
}
and the test:
// index.test.js
import { strictEqual } from "node:assert";
import { it, describe } from "node:test";
import { sum } from "./index.js";
describe("test", () => {
it("should pass", () => {
strictEqual(sum(40, 2), 42);
});
});
Once I run node --experimental-test-coverage --test
I get:
> test@1.0.0 no
> node --experimental-test-coverage --test
▶ test
✔ should pass (0.155709ms)
▶ test (1.117417ms)
ℹ tests 1
ℹ suites 1
ℹ pass 1
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 47.674834
ℹ start of coverage report
ℹ --------------------------------------------------------------
ℹ file | line % | branch % | funcs % | uncovered lines
ℹ --------------------------------------------------------------
ℹ index.js | 100.00 | 100.00 | 100.00 |
ℹ index.test.js | 100.00 | 100.00 | 100.00 |
ℹ --------------------------------------------------------------
ℹ all files | 100.00 | 100.00 | 100.00 |
ℹ --------------------------------------------------------------
ℹ end of coverage report
What is the feature you are proposing to solve the problem?
Ideally, .test.*
should be excluded from the coverage report
What alternatives have you considered?
No response