Accepted answer

i am a bloody idiot and i didn't pay attention to the details.

jest is looking for test.js specifically. not tests.js. my files were labeled as tests.js. it worked inside __tests__/ because jest just looks for anything inside there.

i got it working just fine now, and it shall remain up as a testament to me not looking at the specifics of the regex matches.


i had the same problem, i wanted to run my tests inside drone ci pipeline and had the same error what solved my problem was simply adding workspace to my project.


check if it is small case like filename.test.js. i made a mistake componentname.test.js and got error, fixed it by componetname.test.js


no tests found, exiting with code 1

all i had to do was npm install.

then i hit the debug link at the top of my test. the test was found and execution stopped at the breakpoint. a simple solution to a very frustrating problem.


you just need to change the name of the file. for example if you have a customer.js or customer.ts file and you want to test it. create a new file name is customer.test.js or customer.test.ts after npm test it will test the file which just for testing .


from my side, i was getting this error because i had placed myself (cd) in the directory where the chromedriver was installed, so as not to have to add its path to $path. after i added chromedriver to $path, and placed myself in the directory of my project, everything went fine.


i had the same problem with a react-app. make sure, that the jest config file has the correct file pattern to find the tests:

// jest.config.js
module.exports = {
    testmatch: [

Related Query

More Query from same tag