Skip to content

Commit 9a6904f

Browse files
committedAug 2, 2018
Merge branch 'master' of https://github.com/kulshekhar/ts-jest into feature/upgrade-babel-and-fix-tsconfig
2 parents df71945 + c947791 commit 9a6904f

File tree

3 files changed

+43
-18
lines changed

3 files changed

+43
-18
lines changed
 

‎README.md

+21
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,27 @@ If you *have* explicitly set the `module` property but to a different value than
162162

163163
If you use ["baseUrl"](https://www.typescriptlang.org/docs/handbook/module-resolution.html) and "paths" options for the compiler, see ["moduleNameMapper"](https://facebook.github.io/jest/docs/en/configuration.html#modulenamemapper-object-string-string) option on Jest docs.
164164

165+
For example, with the below config in your tsconfig:
166+
```
167+
"paths": {
168+
"@App/*": [
169+
"src/*"
170+
],
171+
"@Shared/*": [
172+
"src/Shared/*"
173+
]
174+
},
175+
```
176+
177+
Here's what your jest config should look like:
178+
179+
```
180+
"moduleNameMapper": {
181+
"@App/(.*)": "<rootDir>/src/$1",
182+
"@Shared/(.*)": "<rootDir>/src/Shared/$1"
183+
}
184+
```
185+
165186
### Skipping Babel
166187
If you don't use mocks, or synthetic default imports you can skip the babel-transpilation step.
167188
This means `jest.mock()` calls will not be hoisted to the top,

‎package.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,14 @@
6868
},
6969
"dependencies": {
7070
"closest-file-data": "^0.1.4",
71-
"cpx": "^1.5.0",
7271
"fs-extra": "6.0.1",
73-
"jest-config": "^23.4.1",
74-
"lodash": "^4.17.10",
75-
"pkg-dir": "^3.0.0",
76-
"yargs": "^12.0.1"
72+
"lodash": "^4.17.10"
7773
},
7874
"peerDependencies": {
79-
"babel-core": "^7.0.0-0",
80-
"babel-jest": "^23.0.0",
81-
"@babel/preset-env": "^7.0.0",
82-
"jest": "^23.0.0",
83-
"typescript": "2.x"
75+
"babel-core": "^6.0.0 || ^7.0.0-0",
76+
"babel-jest": "^23.0.0 || ^24.0.0",
77+
"jest": "^23.0.0 || ^24.0.0",
78+
"typescript": "^2.0.0 || ^3.0.0"
8479
},
8580
"devDependencies": {
8681
"@babel/core": "^7.0.0-beta.54",
@@ -90,24 +85,29 @@
9085
"@types/fs-extra": "5.0.4",
9186
"@types/jest": "^23.3.0",
9287
"@types/lodash": "^4.14.109",
93-
"@types/node": "10.5.2",
88+
"@types/node": "10.5.5",
9489
"@types/react": "16.4.7",
9590
"@types/yargs": "^11.0.0",
9691
"babel-jest": "^23.4.0",
9792
"babel-preset-jest": "^23.2.0",
93+
"babel-core": "^7.0.0-0",
94+
"cpx": "^1.5.0",
9895
"cross-spawn": "latest",
9996
"cross-spawn-with-kill": "latest",
10097
"doctoc": "latest",
10198
"husky": "^0.14.3",
10299
"jest": "^23.4.1",
100+
"jest-config": "^23.4.1",
103101
"lint-staged": "^7.1.2",
102+
"pkg-dir": "^3.0.0",
104103
"prettier": "^1.12.1",
105104
"react": "16.4.1",
106105
"react-test-renderer": "16.4.1",
107106
"reflect-metadata": "^0.1.12",
108107
"rimraf": "^2.6.2",
109108
"tslint": "^5.11.0",
110-
"typescript": "^2.9.2"
109+
"typescript": "^2.9.2",
110+
"yargs": "^12.0.1"
111111
},
112112
"lint-staged": {
113113
"*.js": [

‎yarn.lock

+10-6
Original file line numberDiff line numberDiff line change
@@ -582,13 +582,13 @@
582582
version "8.0.31"
583583
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.31.tgz#d9af61093cf4bfc9f066ca34de0175012cfb0ce9"
584584

585-
"@types/node@10.5.2":
586-
version "10.5.2"
587-
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.5.2.tgz#f19f05314d5421fe37e74153254201a7bf00a707"
585+
"@types/node@10.5.5":
586+
version "10.5.5"
587+
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.5.5.tgz#8e84d24e896cd77b0d4f73df274027e3149ec2ba"
588588

589-
"@types/react@16.4.6":
590-
version "16.4.6"
591-
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.4.6.tgz#5024957c6bcef4f02823accf5974faba2e54fada"
589+
"@types/react@16.4.7":
590+
version "16.4.7"
591+
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.4.7.tgz#f33f6d759a7e1833befa15224d68942d178a5a3f"
592592
dependencies:
593593
csstype "^2.2.0"
594594

@@ -854,6 +854,10 @@ babel-core@^6.0.0, babel-core@^6.26.0:
854854
slash "^1.0.0"
855855
source-map "^0.5.6"
856856

857+
babel-core@^7.0.0-0:
858+
version "7.0.0-bridge.0"
859+
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece"
860+
857861
babel-generator@^6.18.0:
858862
version "6.26.0"
859863
resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.0.tgz#ac1ae20070b79f6e3ca1d3269613053774f20dc5"

0 commit comments

Comments
 (0)
Please sign in to comment.