I have an npm script in the package.json:
"test:coverage": "vitest run --coverage",
Also, there is a hello.test.ts test file.
I want:
- Vitest to run a single
hello.test.tsfile - Generate a v8 coverage report for the single corresponding
hello.tsfile
Unfortunately, I couldn't find anything suitable in the official documentation: https://vitest.dev/config/#coverage
I tried adding an argument --collectCoverageFrom=src/hello.ts, but it was not recognized.
Running npm run test:coverage hello.test.ts narrows the execution of tests to a hello.test.ts file, but the text coverage report includes other files directly not related to hello.ts.