While creating new tests, I got this error:
Determining test suites to run...Error: ENOENT: no such file or directory, stat '/home/andrew/Documents/wise-fox/The-App/src/tests/components/AlertsComponent/AlertsPages/PromoPage3.test.js'
at Object.fs.statSync (fs.js:948:11)
at Object.statSync (/home/andrew/Documents/wise-fox/The-App/node_modules/graceful-fs/polyfills.js:297:22)
at fileSize (/home/andrew/Documents/wise-fox/The-App/node_modules/jest/node_modules/jest-cli/build/test_sequencer.js:71:73)
at tests.sort (/home/andrew/Documents/wise-fox/The-App/node_modules/jest/node_modules/jest-cli/build/test_sequencer.js:91:34)
at Array.sort (native)
at TestSequencer.sort (/home/andrew/Documents/wise-fox/The-App/node_modules/jest/node_modules/jest-cli/build/test_sequencer.js:77:18)
at /home/andrew/Documents/wise-fox/The-App/node_modules/jest/node_modules/jest-cli/build/run_jest.js:148:26
at Generator.next (<anonymous>)
at step (/home/andrew/Documents/wise-fox/The-App/node_modules/jest/node_modules/jest-cli/build/run_jest.js:27:377)
at /home/andrew/Documents/wise-fox/The-App/node_modules/jest/node_modules/jest-cli/build/run_jest.js:27:537
The error is trying to look for a test file that no longer exists. I had copied a number of tests and then adapted the names of the files as well as the tests inside to fit the new files.
Previously, jest just realized that certain test files had disappeared (because of renaming), but in this case jest thinks these files still exist. I'm not sure why, and I'm not sure how to fix it.
Framework: React 16 OS: Linux Elementary OS
Creating Test Files Jest will treat any file that ends in . test. js or . spec.
Limitations of Jest TestingIt has less tooling and library support available compared to more mature libraries (like Mocha). This can be a big drawback for developers who want to run and debug their tests in an IDE like WebStorm. Using auto-mocking features can slow down your test suite.
For me it was not a snapshot issue, but a cache issue. Run
jest --clearCache
to get rid of it.
Ah, it had something to do with the obsolete snapshot files. I deleted them manually and the tests ran just fine
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With