package.json
:中有一个NPM脚本
"test:coverage": "vitest run --coverage",
,也有一个hello.test.ts
测试文件。 我想要:wittest运行单个文件
为单个对应的
hello.test.ts
的V8覆盖率报告不幸的是,我在官方文档中找不到任何合适的东西:
我尝试添加一个argument
运行hello.ts
将测试的执行缩小到
--collectCoverageFrom=src/hello.ts
文件,但文本覆盖范围报告包含其他与npm run test:coverage hello.test.ts
的直接相关的文件。
您可能会尝试
hello.test.ts
cli参数。
https://vitest.dev/guide/cli.html#coverage-include