Closed
Description
Version
3.0.0-beta.6
Reproduction link
https://github.com/Ldoppea/vue-cli-jest-testmatch
Steps to reproduce
Init project with following options :
Vue CLI v3.0.0-beta.6
? Please pick a preset: Manually select features
? Check the features needed for your project: Unit
? Pick a unit testing solution: Jest
? Where do you prefer placing config for Babel, PostCSS, ESLint, etc.? In package.json
? Save this as a preset for future projects? (Y/n) n
Move /tests/unit/HelloWorld.spec.js
in /src/components/
Add testMatch
in package.json Jest category :
"testMatch": [
"test/**/*.spec.js",
"src/**/*.spec.js"
]
Run npm run test
What is expected?
HelloWorld.spec.js should be tested
What is actually happening?
No test is found by Jest.
Get the following error :
No tests found
In D:\Work\test\vue\testJest
6 files checked.
testMatch: D:\Work\test\vue\testJest\(tests\unit\**\*.spec.(ts|tsx|js)|**\__tests__\*.(ts|tsx|js)) - 0 matches
testPathIgnorePatterns: \\node_modules\\ - 6 matches
Pattern: - 0 matches
ERROR jest exited with code 1.
testMatch still has the value forced by vueCLI
I was able to run my tests from src
folder and without using testMatch
on vueCLI@3.0.0-beta.4. This commit changed the test detection behavior : 2c61d23#diff-17aae08cfc13cba07661681220ddd985 (I do not use typescript)