score:33

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.

score:0

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.

score:0

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

score:1

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.

score:1

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 .

score:2

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.

score:9

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: [
        '<rootdir>/src/**/*.test.js',
        '<rootdir>/src/**/*.test.jsx',
    ],
    ...
}

Related Query

More Query from same tag