Skip to content

Commit

Permalink
Update jest.md
Browse files Browse the repository at this point in the history
Included `testMatch` and edited `transform` entries to meet [#6442](jestjs/jest#6442) from the Jest community.
  • Loading branch information
newmanicspree authored Oct 30, 2019
1 parent 0c36b24 commit c6d6fcc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/testing/jest.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,20 @@ module.exports = {
"roots": [
"<rootDir>/src"
],
testMatch: [
"**/__tests__/**/*.+(ts|tsx|js)",
"**/?(*.)+(spec|test).+(ts|tsx|js)"
],
"transform": {
"^.+\\.tsx?$": "ts-jest"
"^.+\\.(ts|tsx)?$": "ts-jest"
},
}
```

Explanation:

* We always recommend having *all* TypeScript files in a `src` folder in your project. We assume this is true and specify this using the `roots` option.
* The `testMatch` config is a glob pattern matcher for discovering .test / .spec files in ts / tsx / js format.
* The `transform` config just tells `jest` to use `ts-jest` for ts / tsx files.

## Step 3: Run tests
Expand Down

0 comments on commit c6d6fcc

Please sign in to comment.