The coverage seems broken as show in the following pictures
Coverage should still be working :)
23.1.2

23.0.1

[
"Reading tsconfig file from path /home/sauce/application/packages/sauce-cli/tsconfig.json"
]
[
"Original typescript config before modifications: ",
{
"target": 5,
"module": 1,
"lib": [
"lib.es2018.d.ts"
],
"declaration": true,
"removeComments": false,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"alwaysStrict": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": 2,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"inlineSourceMap": true,
"inlineSources": false,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"outDir": "/home/sauce/application/packages/sauce-cli/dist"
}
]
[
"Reading tsconfig file from path /home/sauce/application/packages/sauce-cli/tsconfig.json"
]
[
"Original typescript config before modifications: ",
{
"target": 5,
"module": 1,
"lib": [
"lib.es2018.d.ts"
],
"declaration": true,
"removeComments": false,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"alwaysStrict": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": 2,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"inlineSourceMap": true,
"inlineSources": false,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"outDir": "/home/sauce/application/packages/sauce-cli/dist"
}
]
[
"final compilerOptions:",
{
"target": 5,
"module": 1,
"lib": [
"lib.es2018.d.ts"
],
"declaration": false,
"removeComments": false,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"alwaysStrict": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": 2,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"inlineSourceMap": false,
"inlineSources": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"declarationMap": false,
"emitDeclarationOnly": false,
"sourceMap": true,
"jsx": 2
}
]
[
"tsJestConfig: ",
{
"skipBabel": true,
"disableSourceMapSupport": true
}
]
[
"Compiling via normal transpileModule call"
]
[
"Not using any postprocess hook."
]
Thanks @nolazybits for reporting the issue. Could you please provide a minimal repo to reproduce the issue?
I'll try to give it a shot tomorrow and will update the issue.
Thanks @huafu for being that reactive :D :+1:
@nolazybits any news on this? Also there has been a new release; while I doubt it'll magically fix your issue, you should give it a try since it was related to source mapping...
Sorry haven't had the time to look into this.
I will test again with the new release and will update this issue.
Still very keen on creating the repo if the issue still exists
Thanks @huafu
Sorry coverage is still broken with the last ~release~ tag.
@huafu test repo reproducing the error is here
https://github.com/nolazybits/ts-jest-bug
Readme explains how to have it up and running.
Thanks again!
Have you had any chance/time to look into this pb @huafu ?
In your tsconfig.json, you should enable sourcemap support.
I had the same issue in my project, upgrading to 23.1.3 and removing disableSourceMapSupport worked like a charm. Code coverage is now correct (not hazardous as before), and I even won ~4.5% of code coverage! :smile:
@Kocal I have tried your suggestion and was able to have it working.
Added to the removing the disableSourceMapSupport, I had to remove the skipBabel (which was a problem in previous version when I was debugging).
Seems that the stars are aligned now :)
@huafu I don't know if ts-jest coverage should still work when skipping babel. Please close if it is an expected behavior.
Thanks again everyone!
Yes it should work, and i know where is the issue now, thanks for all your investigations guys ;-)
Problem is, jest goes to read 'canInstrument' of a transformer "plug-in" before calling any method of it, so at that point we cannot know what will be the config (from a file, inline, ...). We will have to set it to false all the time and leverage instrumentation to jest. But that means a 3-pass processing if you activate babel: typescript => babel (in ts-jest) => babel (in jest with istanbul plugin).
Since coverage is working nicely in 23.1.3, should this issue be closed?
Nope, this is still kind of an issue in latest as you must disable babel to have coverage.
@nolazybits you can go try ts-jest@next (see #697) which allow you to have babel activated while having coverage as well.