Reputation: 11789
I have files tests/foo.js
tests/bar.js
. When I run jest tests/foo.js
or jest tests/*.js
, no test is run. How do I run test on files not ending in .test.js
?
Upvotes: 1
Views: 1584
Reputation: 45810
Jest
uses testMatch
to find tests:
By default it looks for
.js
,.jsx
,.ts
and.tsx
files inside of__tests__
folders, as well as any files with a suffix of.test
or.spec
(e.g.Component.test.js
orComponent.spec.js
). It will also find files calledtest.js
orspec.js
.
In your case you can set testMatch
to the following:
testMatch: [ "**/tests/**/*.[jt]s?(x)" ]
...and it should find the tests you have created in your tests
folder.
Upvotes: 2