We want to run the code coverage separately from the npm test.
Abstractions
Use npm run cc command to do the codecoverage for the automation test
Add argument --codecoverage in npm test script to run code coverage.
"cc": "npm run compile && node ./out/test/runTest.js --codecoverage"
Then run test or code coverage according to this argument:
if (process.argv[2] === '--codecoverage') {
extensionTestsPath = path.resolve(dirname, './suite/codeCoverage');
} else {
extensionTestsPath = path.resolve(dirname, './suite/index');
}
Objective
We want to run the code coverage separately from the npm test.
Abstractions
Use npm run cc command to do the codecoverage for the automation test Add argument --codecoverage in npm test script to run code coverage.
"cc": "npm run compile && node ./out/test/runTest.js --codecoverage"
Then run test or code coverage according to this argument: if (process.argv[2] === '--codecoverage') { extensionTestsPath = path.resolve(dirname, './suite/codeCoverage'); } else { extensionTestsPath = path.resolve(dirname, './suite/index'); }
Tests performed
Passed local testing and Github CI
Screen shot