It generates remapped coverage only for main.ts
See original GitHub issueI have a Typescript project and I’m facing issues generating the remapped coverage.
It creates only the coverage for main.ts
instead that for all the files - the original coverage has all the files (but with wrong lines, of course).
This is the relevant part of my package.json:
{
"watch": {
"pretest": {
"patterns": "src",
"extensions": "ts"
},
"start": {
"patterns": "src",
"extensions": "ts"
}
},
"scripts": {
"prestart": "tsc && ./scripts/localModuleUpdate.sh",
"start": "node dist/main",
"pretest": "tslint 'src/**/*.ts'; echo",
"test": "jest",
"watch": "npm-watch",
"postinstall": "typings install && ./scripts/localModuleUpdate.sh",
"coverage": "jest --no-cache --coverage"
},
"dependencies": {
"body-parser": "^1.15.2",
"cors": "^2.8.1",
"csv": "^1.1.0",
"express": "^4.14.0",
"lodash": "^4.17.2",
"mongoose": "^4.7.4",
"typescript": "^2.1.4",
"validator": "^6.2.1"
},
"devDependencies": {
"jest": "^18.0.0",
"npm-watch": "^0.1.6",
"sinon": "^1.17.7",
"supertest": "^2.0.1",
"ts-jest": "^18.0.2",
"tslint": "^4.1.1",
"typings": "^2.1.0"
},
"jest": {
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"transform": {
"^.+\\.(ts|tsx)$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
},
"testRegex": "/__tests__/.*\\.(ts|tsx)$",
"testResultsProcessor": "<rootDir>/node_modules/ts-jest/coverageprocessor.js",
"collectCoverageFrom": [
"src/**/*.tsx",
"src/**/*.ts"
],
}
}
and this is tsconfig.json:
{
"compilerOptions": {
"module": "CommonJS",
"target": "ES6",
"noResolve": false,
"noImplicitAny": false,
"strictNullChecks": true,
"noUnusedParameters": true,
"noUnusedLocals": true,
"outDir": "dist"
},
"include": [
"src/**/*.ts",
"src/**/*.d.ts",
"typings/**/*.d.ts"
],
"exclude": [
"src/f-*/*"
]
}
I run the tests with:
npm coverage
Any suggestion?
Issue Analytics
- State:
- Created 7 years ago
- Comments:27 (11 by maintainers)
Top Results From Across the Web
Coverage Report - incorrect lines · Issue #97 · kulshekhar/ts-jest
The coverage report says that lines 10,11 are not covered, though even that changes ... It generates remapped coverage only for main.ts #104....
Read more >getting nyc/istanbul coverage report to work with typescript
Recently I found a satisfiable solution by using "target": "es6" instead of es5 in tsconfig.json 's compilerOptions .
Read more >Improving your testing code coverage in Javascript
In this article, again, we are going to focus on code coverage that are related to unit tests! The nestjs-cli generate a basic...
Read more >Code Coverage For Nextjs Application - Gleb Bahmutov
Let's give our tests the application's source code so it can generate the file code coverage reports. I will use GitHub Actions to...
Read more >Code Coverage for TypeScript and Other Transpiled Languages
We are going to focus on using the command line for this blog post. At a high level, our workflow is that we...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@danieldiekmeier You’re welcome!
@japhar81 is the one who deserves all the credit for this fix though 😃
@kulshekhar The latest version did indeed solve the issue for me. Thank you for the fix and for this project in general! 😃