Reputation: 3835
When I execute tests with Jest, you have these options:
If I'm in a React app created with create-react-app
, I run the test, I use the p
options, and I digit the pattern, the list of matched files is shown:
Instead, when I run Jest in a custom app I created (adding Jest manually), the matched files are not shown:
How can I see the matched files in Jest like create-react-app
does?
This is my current package.json
's Jest section:
"jest": {
"moduleDirectories": [
"node_modules",
"."
]
}
Upvotes: 1
Views: 916
Reputation: 3835
Add the jest-watch-typeahead
package to the project, and then add this part to the package.json
's Jest section:
"jest": {
"watchPlugins": [
"jest-watch-typeahead/filename",
"jest-watch-typeahead/testname"
]
}
(This is exactly what create-react-app
is doing, and you can see this by ejecting the project with yarn eject
).
If you're using a jest.config.js
file, the package.json
configuration will be ignored. Forget the package.json
and add this property to the main exported object of the jest.config.js
file:
watchPlugins: [
"jest-watch-typeahead/filename",
"jest-watch-typeahead/testname"
]
Upvotes: 2