Skip to content

Commit

Permalink
Merge branch 'master' into cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kulshekhar committed Dec 15, 2017
2 parents 78501f8 + fac86e3 commit ac1d987
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -7,7 +7,7 @@ node_js:
- "4"
before_install:
- sudo sysctl fs.inotify.max_user_watches=524288
- yarn global add greenkeeper-lockfile@1
- yarn global add greenkeeper-lockfile@1 rimraf
before_script:
- greenkeeper-lockfile-update
after_script:
Expand Down
27 changes: 25 additions & 2 deletions README.md
Expand Up @@ -65,7 +65,8 @@ Modify your project's `package.json` so that the `jest` section looks something
"tsx",
"js",
"jsx",
"json"
"json",
"node"
]
}
}
Expand Down Expand Up @@ -244,7 +245,8 @@ Fully completed jest section should look like this:
"tsx",
"js",
"jsx",
"json"
"json",
"node"
]
}
```
Expand Down Expand Up @@ -274,6 +276,27 @@ You'll also need to extend your `transform` regex with `html` extension:
}
```

## Using ES2015+ features in Javascript files

The default setup shown here picks up only `.ts` and `.tsx` files. However, if there are javascript files in your project that use ES2015+ features (spread operator, import, etc), you probably want them processed. There are two ways you can do this:

- use ts-jest to process js files

````
"transform": {
"^.+\\.(t|j)sx?$": "ts-jest"
}
````

- use another transformer to process js files

```
"transform": {
"^.+\\.jsx?$": "<rootDir>/node_modules/babel-jest",
"^.+\\.tsx?$": "ts-jest"
}
```

## Tips
### Importing packages written in TypeScript

Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -71,7 +71,7 @@
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.1",
"babel-preset-jest": "^21.2.0",
"cpx": "^1.5.0",
"fs-extra": "^4.0.2",
"fs-extra": "4.0.3",
"jest-config": "^21.2.1",
"pkg-dir": "^2.0.0",
"source-map-support": "^0.5.0",
Expand All @@ -84,7 +84,7 @@
"devDependencies": {
"@types/babel-core": "^6.7.14",
"@types/es6-shim": "latest",
"@types/fs-extra": "^4.0.0",
"@types/fs-extra": "4.0.7",
"@types/jest": "latest",
"@types/node": "latest",
"@types/react": "latest",
Expand Down
18 changes: 13 additions & 5 deletions yarn.lock
Expand Up @@ -45,9 +45,9 @@
version "0.31.35"
resolved "https://registry.yarnpkg.com/@types/es6-shim/-/es6-shim-0.31.35.tgz#d11920d8d4c938ad912c51e699ed7ba2505ba1eb"

"@types/fs-extra@^4.0.0":
version "4.0.2"
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-4.0.2.tgz#7b9b1bbf85962cbe029b5a83c9b530d7c75af3ba"
"@types/fs-extra@4.0.7":
version "4.0.7"
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-4.0.7.tgz#02533262386b5a6b9a49797dc82feffdf269140a"
dependencies:
"@types/node" "*"

Expand Down Expand Up @@ -1469,7 +1469,15 @@ from@~0:
version "0.1.7"
resolved "https://registry.yarnpkg.com/from/-/from-0.1.7.tgz#83c60afc58b9c56997007ed1a768b3ab303a44fe"

fs-extra@^4.0.0, fs-extra@^4.0.2:
fs-extra@4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94"
dependencies:
graceful-fs "^4.1.2"
jsonfile "^4.0.0"
universalify "^0.1.0"

fs-extra@^4.0.0:
version "4.0.2"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.2.tgz#f91704c53d1b461f893452b0c307d9997647ab6b"
dependencies:
Expand Down Expand Up @@ -2363,7 +2371,7 @@ levn@~0.3.0:
prelude-ls "~1.1.2"
type-check "~0.3.2"

lint-staged@6.0.0:
lint-staged@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-6.0.0.tgz#7ab7d345f2fe302ff196f1de6a005594ace03210"
dependencies:
Expand Down

0 comments on commit ac1d987

Please sign in to comment.