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