Let's say that I have a project structure like below:
src/index.js
src/test/foo.js
test/integration/src/index.test.js
test/unit/src/index.test.js
jest.config.json
In jest.config.json
I have my testMatch
{
"testMatch": [
"test/**"
]
}
When I run jest with --config jest.config.json
it matches with 0 file.
testMatch: test/** - 0 matches
testPathIgnorePatterns: /node_modules/ - 5 matches
testRegex: - 0 matches
Pattern: - 0 matches
I thought it might be related with some incorrect rootDir
since testMatch
is relative to that. I run jest in debug mode to see my root and it seems it's correct. It shows my project directory. (where jest.config.json
exists)
When I change my testMatch
to **/test/**
it can detect my tests in test/
directory but that's not what I want because then it also matches with src/test/
directory.
Why it cannot detect my tests in test/
directory? Is my glob pattern incorrect?