Skip to content

Commit

Permalink
Add error when running jest directly
Browse files Browse the repository at this point in the history
```
$ jest
 FAIL  scripts/jest/dont-run-jest-directly.js
  ● Test suite failed to run

    Don't run `jest` directly. Run `yarn test` instead.

    > 1 | throw new Error("Don't run `jest` directly. Run `yarn test` instead.");
      2 |

      at Object.<anonymous> (scripts/jest/dont-run-jest-directly.js:1:96)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.866s
Ran all test suites.
```
  • Loading branch information
sophiebits committed May 1, 2018
1 parent 920f30e commit fa1ba18
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@
"devEngines": {
"node": "8.x || 9.x"
},
"jest": {
"testRegex": "/scripts/jest/dont-run-jest-directly\\.js$"
},
"scripts": {
"build": "npm run version-check && node ./scripts/rollup/build.js",
"flow-coverage": "flow-coverage-report --config ./.flowcoverage",
Expand Down
1 change: 1 addition & 0 deletions scripts/jest/dont-run-jest-directly.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
throw new Error("Don't run `jest` directly. Run `yarn test` instead.");

0 comments on commit fa1ba18

Please sign in to comment.