【发布时间】:2022-08-19 01:31:22
【问题描述】:
我正在实现一个 VSCode 扩展。我在this link 之后设置了项目。
它会生成一个带有src/test/runTest.ts 文件的启动项目:
import * as path from \'path\';
import { runTests } from \'@vscode/test-electron\';
async function main() {
try {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, \'../../\');
// The path to test runner
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, \'./suite/index\');
// Download VS Code, unzip it and run the integration test
await runTests({ extensionDevelopmentPath, extensionTestsPath });
} catch (err) {
console.error(\'Failed to run tests\');
process.exit(1);
}
}
main();
以及package.json 中的一个命令:
{
\"compile\": \"tsc -p ./\",
\"pretest\": \"npm run compile && npm run lint\",
\"lint\": \"eslint src --ext ts\",
\"test\": \"node ./out/test/runTest.js\"
}
有没有办法用它生成覆盖率报告?
-
这可能是一个调试器功能,可以为它到达的每一行注入对
line X is executing的调用,将事件处理程序附加到此,或订阅事件,由测试运行程序完成
标签: testing visual-studio-code vscode-extensions test-coverage