Add error when running jest directly (#12726)
``` $ 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. ```
Sophie Alpert committed
May 1, 2018 at 12:46 UTC
200357596aed51d5a71cac0996e3a0510e507156
2 files changed
+6
package.json
+3
@@ -103,6 +103,9 @@
103
"devEngines": {
104
"node": "8.x || 9.x"
105
},
106
+ "jest": {
107
+ "testRegex": "/scripts/jest/dont-run-jest-directly\\.js$"
108
+ },
109
"scripts": {
110
"build": "npm run version-check && node ./scripts/rollup/build.js",
111
"flow-coverage": "flow-coverage-report --config ./.flowcoverage",
scripts/jest/dont-run-jest-directly.js
new
+3
@@ -0,0 +1,3 @@
1
+'use strict';
2
+
3
+throw new Error("Don't run `jest` directly. Run `yarn test` instead.");