-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove mocksPattern, rename testPathDirs to roots. #2776
Conversation
docs/Configuration.md
Outdated
|
||
There are times where you only want Jest to search in a single sub-directory (such as cases where you have a `src/` directory in your repo), but prevent it from accessing the rest of the repo. | ||
|
||
*Note: While `rootDir` is mostly used as a token to be re-used in other configuration options, `roots` is used by the internals of Jest to locate test files and source files. By default, `roots` has a single entry `<rootDir>` but there are cases where you want to have multiple roots within one project, for example `roots: ["<rootDir>/src/", "<rootDir>/tests/"]`.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd bold this phrase: "locate test files and source files"
} | ||
|
||
Please update your configuration. | ||
`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also mention deprecating mocksPattern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nobody can use it because it is broken, so I'd rather just kill it directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😄
@@ -11,11 +11,11 @@ | |||
|
|||
const path = require('path'); | |||
|
|||
const mocksPattern = '__mocks__'; | |||
const MOCKS_PATTERN = path.sep + '__mocks__' + path.sep; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could hoist MOCKS_PATTERN
it to jest-util
? It appears in 2 packages and 3 different places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want jest-haste-map to depend on jest-util.
@cpojer I've removed mocksPattern in this PR #2705 * comment: #2705 (comment)
|
d9b69cd
to
e44cbee
Compare
finally managed to find some time to fix things here. |
Codecov Report
@@ Coverage Diff @@
## master #2776 +/- ##
=========================================
Coverage ? 67.65%
=========================================
Files ? 140
Lines ? 5076
Branches ? 0
=========================================
Hits ? 3434
Misses ? 1642
Partials ? 0
Continue to review full report at Codecov.
|
This in preparation of future Jest versions (> 18.1) that will have `testPathDirs` renamed to `roots`. See jestjs/jest#2776.
* chore: remove some template files from the plugin-seed * chore: update project files for newer Stryker version * chore(doc): Show correct Travis badge * test(all): Add sample project for running integration tests * fix(build) Explicitly list jest-runtime as dep * fix(TestRunner): Add testPathDirs option Add `testPathDirs` option to the jest test runner options in order to make it work on the windows platform. I'm not jet sure that `process.cwd()` is the correct value, but it seems to work for now. * chore(build) Do not attempt to run on Node < 6.0.0 * fix(runner) Also specify `roots` option This in preparation of future Jest versions (> 18.1) that will have `testPathDirs` renamed to `roots`. See jestjs/jest#2776.
* Remove mocksPattern config. * Rename `testPathDirs` to `roots`. * Fix mocks pattern.
* Remove mocksPattern config. * Rename `testPathDirs` to `roots`. * Fix mocks pattern.
* chore: remove some template files from the plugin-seed * chore: update project files for newer Stryker version * chore(doc): Show correct Travis badge * test(all): Add sample project for running integration tests * fix(build) Explicitly list jest-runtime as dep * fix(TestRunner): Add testPathDirs option Add `testPathDirs` option to the jest test runner options in order to make it work on the windows platform. I'm not jet sure that `process.cwd()` is the correct value, but it seems to work for now. * chore(build) Do not attempt to run on Node < 6.0.0 * fix(runner) Also specify `roots` option This in preparation of future Jest versions (> 18.1) that will have `testPathDirs` renamed to `roots`. See jestjs/jest#2776.
The roots and testPathDirs attributes of the configuration passed to Jest may both be left undefined. This has the added advantage of continuing to work once testPathDirs has been deprecated in Jest 19.0.0. See jestjs/jest#2776
* chore: remove some template files from the plugin-seed * chore: update project files for newer Stryker version * chore(doc): Show correct Travis badge * test(all): Add sample project for running integration tests * fix(build) Explicitly list jest-runtime as dep * fix(TestRunner): Add testPathDirs option Add `testPathDirs` option to the jest test runner options in order to make it work on the windows platform. I'm not jet sure that `process.cwd()` is the correct value, but it seems to work for now. * chore(build) Do not attempt to run on Node < 6.0.0 * fix(runner) Also specify `roots` option This in preparation of future Jest versions (> 18.1) that will have `testPathDirs` renamed to `roots`. See jestjs/jest#2776.
The roots and testPathDirs attributes of the configuration passed to Jest may both be left undefined. This has the added advantage of continuing to work once testPathDirs has been deprecated in Jest 19.0.0. See jestjs/jest#2776
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
As mentioned in #2600.
Test plan
jest