-
|
Hi, I'm successfully using tap for my TypeScript projects. However, during development, while working on a single file, I prefer to run tap only for that file, to save some time. "test-ci": "tap run --reporter=terse --disable-coverage",
"test": "tap run --disable-coverage",
"test-coverage": "tap run",
"test-all": "tap run --reporter=tap --disable-coverage",
"test-one-010": "tap run --reporter=tap tests/tap/010-*.ts",
"test-one-020": "tap run --reporter=tap tests/tap/020-*.ts",
...The singular test itself runs fine, but I'm puzzled that the coverage report always shows the full list of tested files, each with various (and totally irelevant in this use case) coverage figures. Is this the expected behaviour? Is it possible to somehow configure tap to show the coverage figures only for the input files? I'm running tap 21.5.0 and the configuration is: Here is an example of a simple run: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
Use a coverage map. |
Beta Was this translation helpful? Give feedback.
-
|
In case someone else will stumble on this issue, here is a bit more detailed explanation: I renamed all test files in export default function getCoverageMapFiles (testFilePath) {
const sourceFilePath = testFilePath.replace(/tests\/tap/, 'src')
// console.log(`Getting coverage map for source file: ${sourceFilePath}`)
return sourceFilePath
}When I run a single test, I pass this file to "test-one": "tap run --reporter=tap --coverage-map=tests/coverage-map.js tests/tap/classes/init-template-base.ts",When I run all tests and need to show the coverage results for the entire project, I do not pass any map, neither in |
Beta Was this translation helpful? Give feedback.
In case someone else will stumble on this issue, here is a bit more detailed explanation:
I renamed all test files in
tests/tapto have the same names as the source file insrc, then I created a smallcoverage-map.jsfile that exports a default function that maps each test file to the corresponding source file:When I run a single test, I pass this file to
tap runvia the----coverage-map=option: