有一种方法可以使用Vitest&V8生成单个测试文件的文本覆盖报告?

问题描述 投票:0回答:0
我在

package.json

中有一个NPM脚本

"test:coverage": "vitest run --coverage",
,也有一个

hello.test.ts

测试文件。
我想要:

wittest运行单个文件

为单个对应的
    hello.test.ts
  1. 文件
    的V8覆盖率报告
    
    不幸的是,我在官方文档中找不到任何合适的东西:
  2. https://vitest.dev/config/#coverage
  3. 我尝试添加一个
    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
    

v8 vitest
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.