Skip to content

Commit c076956

Browse files
committed
fix: remove outDir when collecting coverage
1 parent 96e799c commit c076956

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ Prior to version `20.0.0`, coverage reports could be obtained using the inbuilt
5858

5959
To generate coverage results, set the `mapCoverage` property in the `jest` configuration section to `true`.
6060

61+
> Please note that the `outDir` property in the `jest` configuration section is removed in coverage mode, due to [#201](https://github.com/kulshekhar/ts-jest/issues/201).
62+
6163
### React Native
6264

6365
There is a few additional steps if you want to use it with React Native.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ts-jest",
3-
"version": "20.0.0",
3+
"version": "20.0.1",
44
"main": "index.js",
55
"types": "./dist/index.d.ts",
66
"description": "A preprocessor with sourcemap support to help use Typescript with Jest",

src/utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ export function getTSConfig(globals, collectCoverage: boolean = false) {
104104

105105
config.inlineSourceMap = true;
106106
config.inlineSources = true;
107+
108+
if (config.outDir) {
109+
// the coverage report is broken if `.outDir` is set
110+
// see https://github.com/kulshekhar/ts-jest/issues/201
111+
delete config.outDir;
112+
}
107113
}
108114

109115
if (config.allowSyntheticDefaultImports) {

0 commit comments

Comments
 (0)