-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coverage breaks sourcemaps #917
Comments
I confirmed that this was the cause of my inability to debug tests via vscode-jest. Turning off code coverage allowed the sourcemaps to be built properly. |
Any thoughts on the cause/fix? I started seeing this today. My index.ts file has around 100 lines but jest is reporting console.log calls on lines > 1000. |
Code coverage breaks sourcemaps in ts-jest which makes the debugger mostly unusable. This is documented as an open issue here: kulshekhar/ts-jest#917
I can confirm that this is an issue for me as well. It was driving me crazy because it also prevented debuggers from stepping through the code. Glad I found that I was not the only one experiencing this. |
Can confirm, VSCode debugger reports line numbers >6000 in file with 300 lines and fails to hit breakpoints when using the ts-jest interpreter and jest test runner. Disabling code coverage appears to reduce or resolve the problem(s). |
I am getting this problem as well when I turn on coverage. Looking through similar issues I found #484 which has some commits to fix this same issue though, and I am using the latest build, so I am kind of confused... |
Hi all, I am having the same issue. I took some time and created a small repository that reproduces the issue: https://github.com/wesleygrimes/ts-jest-coverage-incorrect-line-numbers I am seeing this issue as well with
module.exports = {
testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'],
transform: {
'^.+\\.(ts|js|html)$': 'ts-jest'
},
roots: ['<rootDir>/src'],
moduleFileExtensions: ['ts', 'js', 'html'],
collectCoverage: true,
coverageReporters: ['html']
}; We need Thanks! |
Was fixed in Workaround for debugging:
"test": "jest --config ./jestConfig.json --coverage" |
any news on when this may be fixed? Being locked on v 23.1.2 is making moving to jest 24 a painful experience. |
In order to get debugging to work, I removed Of course, this is just a workaround until this is fixed. |
I found a fix that works well for me. If you add
|
* remove collectCoverage from jest.config.js and move to package.json test script kulshekhar/ts-jest#917 * add lodash dependency (for cloneDeep function) * reorder ContractCall and SmartContract values in PayloadType enum * contract deploy and contract-call tests * implement intoInitialSighashAuth() and clear() functions * fix signBegin function (should clone the transaction before clearing its Auth) * npm audit fix
This is not ts-jest issue. Please check related discussion in jestjs/jest#5739 |
This is a workaround since enabling coverage breaks sourceMaps. See: kulshekhar/ts-jest#917 See: jestjs/jest#5739
This is a workaround since enabling coverage breaks sourceMaps. See: kulshekhar/ts-jest#917 See: jestjs/jest#5739
This is a workaround since enabling coverage breaks sourceMaps. See: kulshekhar/ts-jest#917 See: jestjs/jest#5739
Issue :
If user enables test coverage with Jest then the sourcemaps are not correct.
Expected behavior :
Lines should be shown correctly, even if developer enables coverage report with Jest.
Minimal repo :
Github project: https://github.com/maxpolski/ts-react-jest/ Please kindly note that this is NOT my repository
Run jest with coverage option.
You will notice that the sourcemaps are not working correctly. To make sure, you can add console.log() in any React component and compare the line where console.log occured with the one displayed in the jest output.
Interestingly, sourcemaps work absolutely fine in test files, but not in source files.
The text was updated successfully, but these errors were encountered: