Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React - Jest : No tests found, exiting with code 0

Tags:

reactjs

jestjs

I'm learning ReactJS for a few weeks but I'm facing an issue that's impossible to solve by myself.

I use create-react-app command to start react project but it is totally impossible to use npm test after that. Even if I don't touch anything in the project, when I try to run npm test I only get "No tests found, exiting with code 0".... When I just create the project there is src/App.test.js but the command found nothing..... :(

Someone I sent the folder succeeded to run the tests.... is it possible that the problem comes from my computer/environment (Windows 10) ?

Thanks for help.

Have a good day

like image 892
Kendrakstef Avatar asked Oct 27 '25 03:10

Kendrakstef


1 Answers

Add this line to your "package.json"

  1. open package.json

  2. find scripts in that "test" : "react scripts test" replace this with

    "test": "react-scripts test --watchAll --testMatch **/src/**/*.test.js"
    
  3. Now run npm test.

It works!

like image 184
JASBIR SINGH Avatar answered Oct 28 '25 16:10

JASBIR SINGH



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!