Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/kulshekhar/ts-jest into f…
Browse files Browse the repository at this point in the history
…eature/upgrade-babel-and-fix-tsconfig
  • Loading branch information
huafu committed Aug 2, 2018
2 parents df71945 + c947791 commit 9a6904f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 18 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,27 @@ If you *have* explicitly set the `module` property but to a different value than

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.

For example, with the below config in your tsconfig:
```
"paths": {
"@App/*": [
"src/*"
],
"@Shared/*": [
"src/Shared/*"
]
},
```

Here's what your jest config should look like:

```
"moduleNameMapper": {
"@App/(.*)": "<rootDir>/src/$1",
"@Shared/(.*)": "<rootDir>/src/Shared/$1"
}
```

### Skipping Babel
If you don't use mocks, or synthetic default imports you can skip the babel-transpilation step.
This means `jest.mock()` calls will not be hoisted to the top,
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,14 @@
},
"dependencies": {
"closest-file-data": "^0.1.4",
"cpx": "^1.5.0",
"fs-extra": "6.0.1",
"jest-config": "^23.4.1",
"lodash": "^4.17.10",
"pkg-dir": "^3.0.0",
"yargs": "^12.0.1"
"lodash": "^4.17.10"
},
"peerDependencies": {
"babel-core": "^7.0.0-0",
"babel-jest": "^23.0.0",
"@babel/preset-env": "^7.0.0",
"jest": "^23.0.0",
"typescript": "2.x"
"babel-core": "^6.0.0 || ^7.0.0-0",
"babel-jest": "^23.0.0 || ^24.0.0",
"jest": "^23.0.0 || ^24.0.0",
"typescript": "^2.0.0 || ^3.0.0"
},
"devDependencies": {
"@babel/core": "^7.0.0-beta.54",
Expand All @@ -90,24 +85,29 @@
"@types/fs-extra": "5.0.4",
"@types/jest": "^23.3.0",
"@types/lodash": "^4.14.109",
"@types/node": "10.5.2",
"@types/node": "10.5.5",
"@types/react": "16.4.7",
"@types/yargs": "^11.0.0",
"babel-jest": "^23.4.0",
"babel-preset-jest": "^23.2.0",
"babel-core": "^7.0.0-0",
"cpx": "^1.5.0",
"cross-spawn": "latest",
"cross-spawn-with-kill": "latest",
"doctoc": "latest",
"husky": "^0.14.3",
"jest": "^23.4.1",
"jest-config": "^23.4.1",
"lint-staged": "^7.1.2",
"pkg-dir": "^3.0.0",
"prettier": "^1.12.1",
"react": "16.4.1",
"react-test-renderer": "16.4.1",
"reflect-metadata": "^0.1.12",
"rimraf": "^2.6.2",
"tslint": "^5.11.0",
"typescript": "^2.9.2"
"typescript": "^2.9.2",
"yargs": "^12.0.1"
},
"lint-staged": {
"*.js": [
Expand Down
16 changes: 10 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -582,13 +582,13 @@
version "8.0.31"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.31.tgz#d9af61093cf4bfc9f066ca34de0175012cfb0ce9"

"@types/[email protected].2":
version "10.5.2"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.5.2.tgz#f19f05314d5421fe37e74153254201a7bf00a707"
"@types/[email protected].5":
version "10.5.5"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.5.5.tgz#8e84d24e896cd77b0d4f73df274027e3149ec2ba"

"@types/[email protected].6":
version "16.4.6"
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.4.6.tgz#5024957c6bcef4f02823accf5974faba2e54fada"
"@types/[email protected].7":
version "16.4.7"
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.4.7.tgz#f33f6d759a7e1833befa15224d68942d178a5a3f"
dependencies:
csstype "^2.2.0"

Expand Down Expand Up @@ -854,6 +854,10 @@ babel-core@^6.0.0, babel-core@^6.26.0:
slash "^1.0.0"
source-map "^0.5.6"

babel-core@^7.0.0-0:
version "7.0.0-bridge.0"
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece"

babel-generator@^6.18.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.0.tgz#ac1ae20070b79f6e3ca1d3269613053774f20dc5"
Expand Down

0 comments on commit 9a6904f

Please sign in to comment.