Skip to content

Commit

Permalink
Merge pull request #449 from kulshekhar/upgrade
Browse files Browse the repository at this point in the history
Upgrade
  • Loading branch information
kulshekhar authored Feb 25, 2018
2 parents b791a43 + a8df89b commit cb2d576
Show file tree
Hide file tree
Showing 14 changed files with 813 additions and 250 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ You can try using ts-jest with `jest@test`; use at your own risk! (And file an i

Prior to version `20.0.0`, coverage reports could be obtained using the inbuilt coverage processor in ts-jest. Starting with version `20.0.0`, ts-jest delegates coverage processing to jest and no longer includes a coverage processor.

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

> 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).
## Default Setup
Expand Down
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-jest",
"version": "22.0.4",
"version": "22.4.0",
"main": "index.js",
"types": "./dist/index.d.ts",
"description": "A preprocessor with sourcemap support to help use Typescript with Jest",
Expand Down Expand Up @@ -64,16 +64,15 @@
"babel-core": "^6.24.1",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.1",
"babel-preset-jest": "^22.0.1",
"babel-preset-jest": "^22.4.0",
"cpx": "^1.5.0",
"fs-extra": "4.0.3",
"jest-config": "^22.0.1",
"jest-config": "^22.4.0",
"pkg-dir": "^2.0.0",
"source-map-support": "^0.5.0",
"yargs": "^11.0.0"
},
"peerDependencies": {
"jest": "^22.0.1 || ^22.1.0-alpha.1 || ^23.0.0-alpha.1",
"jest": "^22.4.0 || ^22.5.0-alpha.1 || ^23.0.0-alpha.1",
"typescript": "2.x"
},
"devDependencies": {
Expand All @@ -83,13 +82,12 @@
"@types/jest": "latest",
"@types/node": "latest",
"@types/react": "latest",
"@types/source-map-support": "latest",
"babel-preset-env": "^1.6.0",
"cross-spawn": "latest",
"cross-spawn-with-kill": "latest",
"doctoc": "latest",
"husky": "^0.14.3",
"jest": "^22.0.1",
"jest": "^22.4.0",
"lint-staged": "^7.0.0",
"prettier": "^1.5.3",
"react": "latest",
Expand Down
4 changes: 3 additions & 1 deletion src/preprocessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ export function process(
tsTranspiled.outputText,
outputText,
);

flushLogs();
return modified;

return { code: modified, map: tsTranspiled.sourceMapText };
}

export function getCacheKey(
Expand Down
6 changes: 3 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ export function getTSConfig(
logOnce('Original typescript config before modifications: ', { ...config });

// ts-jest will map lines numbers properly if inlineSourceMap and
// inlineSources are set to true. For testing, we don't need the
// sourceMap configuration
delete config.sourceMap;
// inlineSources are set to true. The sourceMap configuration
// is used to send the sourcemap back to Jest
config.sourceMap = true;
config.inlineSourceMap = true;
config.inlineSources = true;

Expand Down
1 change: 1 addition & 0 deletions tests/__tests__/tsconfig-default.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe('get default ts config', () => {
const result = getTSConfig(null);

expect(result).toEqual({
sourceMap: true,
inlineSourceMap: true,
inlineSources: true,
target: ts.ScriptTarget.ES2015,
Expand Down
3 changes: 3 additions & 0 deletions tests/__tests__/tsconfig-string.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('get ts config from string', () => {
});

expect(result).toMatchObject({
sourceMap: true,
inlineSourceMap: true,
inlineSources: true,
target: ts.ScriptTarget.ES2015,
Expand Down Expand Up @@ -66,6 +67,7 @@ describe('get ts config from string', () => {
});

expect(result).toEqual({
sourceMap: true,
inlineSourceMap: true,
inlineSources: true,
target: ts.ScriptTarget.ES2015,
Expand All @@ -84,6 +86,7 @@ describe('get ts config from string', () => {
});

expect(result).toEqual({
sourceMap: true,
inlineSourceMap: true,
inlineSources: true,
target: ts.ScriptTarget.ES5,
Expand Down
1 change: 0 additions & 1 deletion tests/hoist-errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"Hello.ts",
"NullCoverage.js"
],
"mapCoverage": true,
"moduleFileExtensions": [
"ts",
"tsx",
Expand Down
1 change: 0 additions & 1 deletion tests/jestconfig-test/jest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"mapCoverage": true,
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"testEnvironment": "jsdom",
"coverageReporters": [
Expand Down
1 change: 0 additions & 1 deletion tests/simple-async/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"Hello.ts",
"NullCoverage.js"
],
"mapCoverage": true,
"moduleFileExtensions": [
"ts",
"tsx",
Expand Down
1 change: 0 additions & 1 deletion tests/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"Hello.ts",
"NullCoverage.js"
],
"mapCoverage": true,
"moduleFileExtensions": [
"ts",
"tsx",
Expand Down
1 change: 0 additions & 1 deletion tests/skip-babelrc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"Hello.ts",
"NullCoverage.js"
],
"mapCoverage": true,
"moduleFileExtensions": [
"ts",
"tsx",
Expand Down
1 change: 0 additions & 1 deletion tests/use-strict/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"transform": {
"^.+\\.tsx?$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
},
"mapCoverage": true,
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": [
"ts",
Expand Down
1 change: 0 additions & 1 deletion tests/watch-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"transform": {
"^.+\\.tsx?$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
},
"mapCoverage": true,
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"coverageReporters": [
"json"
Expand Down
Loading

0 comments on commit cb2d576

Please sign in to comment.