You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
react-scripts test command stopped working after update to ^4.0.3 from ^3.0.0.
It shows this error on terminal:
● Validation Error:
Watch plugin jest-watch-typeahead/filename cannot be found. Make sure the watchPlugins configuration option points to an existing node module.
Configuration Documentation:
https://jestjs.io/docs/configuration.html
error Command failed with exit code 1.
Nothing has changed on the code. Only react-scripts package. Tests were working fine before the update.
The project is not ejected and it is not intended to be.
Did you try recovering your dependencies?
Yes, I tried.
yarn version: 1.22.10
Which terms did you search for in User Guide?
I've search for 'react-scripts test' and 'watchPlugins' and all I found is that I need to eject the project. I don't understand why. It was never like that. So I think that is not the solution to the problem.
Steps to reproduce
Open a terminal on the CRA project root
Run yarn
Run yarn test
Expected behavior
I expect tests run fine. Like before updating to ^4.0.3.
Actual behavior
react-scripts test command stops working after update react-scripts library to ^4.0.3 from ^3.0.0.
It shows this error on terminal:
● Validation Error:
Watch plugin jest-watch-typeahead/filename cannot be found. Make sure the watchPlugins configuration option points to an existing node module.
Configuration Documentation:
https://jestjs.io/docs/configuration.html
error Command failed with exit code 1.
I've also run into this same situation with a CRA currently, non-ejected, with react-scripts 4.0.3, though I reproduced it for 4.0.x in general. Same situation where I'm running the following inside my CRA:
yarn
yarn test
and then getting the same error:
Validation Error:
Watch plugin jest-watch-typeahead/filename cannot be found. Make sure the watchPlugins configuration option points to an existing node module.
Configuration Documentation:
https://jestjs.io/docs/configuration.html
Jest Config
Since this is through CRA, the only jest config options in my package.json are essentially:
Anyway, apologies in advance if I'm missing something simple (tooling/build stuff for full-stack apps is a bit new for me, and this project predates my work on it), but I mostly just wanted to document another case of this. If I find a work-around, fix, etc., I'll be sure to return and share for others.
I have had the same issue and one important thing to notice is that the newest released version of jest-watch-typeahead is now written in native ESM and will break with the following error:
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module
Make sure to install the version compatible with Jest 26 e non native ESM modules.
yarn add --exact jest-watch-typeahead@0.6.5
Reacted by Raj Rajhans, Olivier Beaulieu, Christian Gärtner, Ivo Plamenac, farshid, Cesar Santana, batailley, stephan5463, Pere Pages, Saeed ET and 30 more
Reacted by Raj Rajhans, Eduardo Amador Lucas, z, Mohamed Ghobashy, Pere Pages, Javier Brea, Mike Griffith, AlkTheOrg, Eduardo Wesley, Matheus Couto and 1 more
Reacted by Jamil Abbas, Mark A A, Matheus Couto and Alex Nahayo
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.
Reacted by Huespal, Felix Clinthorne, Tushar Jain, willie and Pavel 'Strajk' Dolecek
Hello.
I created a related issue.
After adding the correct jest-watch-typeahead v.0.6.5 package as @giuliogallerini pointed out, the problems continues.
Thank you.
Had the same issue after updating react-scripts4.0.3 → 5.0.1.
It's not necessary to add jest-watch-typeahead as a dependency to the package.json, no-save install was enough in my case: npm install --no-save jest-watch-typeahead@1.1.0
Running npm ci might be more robust solution, though.
Activity
aschuermann-at-neusta commentedon Jun 10, 2021
Same Problem here
Elliot128 commentedon Jun 23, 2021
Running into this as well.
kkgowtamasa commentedon Jul 1, 2021
facing the same issue.
Warix3 commentedon Jul 6, 2021
I've fixed it by installing the plugin jest-watch-typeahead
danpadua commentedon Jul 29, 2021
Work for me!!! Thanks
MiroslavPetrik commentedon Jul 30, 2021
Same here. Could be yarn issue?
k61b commentedon Jul 30, 2021
Thank you!
seanmhanson commentedon Oct 6, 2021
Repro
I've also run into this same situation with a CRA currently, non-ejected, with react-scripts
4.0.3, though I reproduced it for4.0.xin general. Same situation where I'm running the following inside my CRA:yarnyarn testand then getting the same error:
Jest Config
Since this is through CRA, the only jest config options in my
package.jsonare essentially:Running
yarn testwith additional options such as below causes the same validation error:yarn react-scripts test --testPathPattern App.test.tsxApplication Structure
I suspect that this might be related to the structure of this application, as I've recently changed it.
Here's a simplified diagram of the (full-stack) project:
Root (express server)
Client Application (made with latest CRA)
Anyway, apologies in advance if I'm missing something simple (tooling/build stuff for full-stack apps is a bit new for me, and this project predates my work on it), but I mostly just wanted to document another case of this. If I find a work-around, fix, etc., I'll be sure to return and share for others.
ggwzrd commentedon Oct 13, 2021
I have had the same issue and one important thing to notice is that the newest released version of
jest-watch-typeaheadis now written in native ESM and will break with the following error:Error [ERR_REQUIRE_ESM]: Must use import to load ES ModuleMake sure to install the version compatible with Jest 26 e non native ESM modules.
stale commentedon Jan 9, 2022
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.
MarcelDurganteDev commentedon Feb 8, 2022
same problem here
Huespal commentedon Mar 10, 2022
Hello.
I created a related issue.
After adding the correct jest-watch-typeahead v.0.6.5 package as @giuliogallerini pointed out, the problems continues.
Thank you.
dooman87 commentedon Mar 13, 2022
I noticed that I didn't have
jest-watch-typeaheadin mynode_modules. Installing it solved the problem:npm install --save-dev jest-watch-typeaheadThat's a workaround of course rather than solving the problem.
changed travis yml
wulinjie122 commentedon May 10, 2022
any update with this issue?
jasonaravanis commentedon May 31, 2022
Encountered same issue
shiraze commentedon Jul 4, 2022
I didn't have the issue when moving to 4.0.3, but saw the issue when going to 5.0.0
Just found a linked issue that relates to my issue: #11792
user2695 commentedon Sep 3, 2022
The issue has to do with your node version. Update your node to the latest stable version to fix it.
gmmvllfrt commentedon Sep 9, 2022
I had the same error and I found a work around.
npm i -D --exact jest-watch-typeahead@0.6.5then there'll be an error for the jest version, I changed it to version 27.0.0, same the ts-jest.
edloidas commentedon Sep 13, 2022
Had the same issue after updating
react-scripts4.0.3→5.0.1.It's not necessary to add
jest-watch-typeaheadas a dependency to thepackage.json, no-save install was enough in my case:npm install --no-save jest-watch-typeahead@1.1.0Running
npm cimight be more robust solution, though.