-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Tests are not found out of the box #1686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi, the same happened to me on MacOS 10.13.4 High Sierra, I removed the enclosing round brackets in testMatch: [
"<rootDir>/tests/unit/**/*.spec.(js|jsx|ts|tsx)|<rootDir>/**/__tests__/*.(js|jsx|ts|tsx)"
] |
@allochi not working neither, but I'm on Windows 10 |
Allochi solution on mac works. but not in windows. |
testMatch: [
"<rootDir>/tests/unit/**/*.spec.(js|jsx|ts|tsx)",
"<rootDir>/**/__tests__/*.(js|jsx|ts|tsx)"
] It runs any test in the project's |
If you plan to have all your tests in testMatch: [
"<rootDir>/tests/unit/**/*.spec.(js|jsx|ts|tsx)"
] |
Not working /: |
The issue on windows seems to be caused by the fact that jest v23 uses micromatch v3.1.10, while jest v22 used micromatch v2.3.11. let micromatch = require('micromatch');
let path = 'D:\\app\\tests\\unit\\HelloWorld.spec.js';
let glob= 'D:/app/(tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx))';
console.log(micromatch([path], glob));
// with [email protected] logs
// [ 'D:/app/tests/unit/HelloWorld.spec.js' ]
// with [email protected] logs
// [] |
I think the best solution would be to downgrade to jest 22, until the bug is addressed there. |
hello, I have same problem on windows 10, however, I can run test correctly in the following way
|
On Ubuntu I have the same problem, I just add an additional path to
|
On Windows the listed workarounds don't seem to work. Although not idea, I found this combination means I can run tests again:
|
@mildc055ee 's solution worked for me in Windows 10 |
This issue is not fixed on Windows with #1756 😞. I just re-ran |
Try this one: 96778b2#diff-29994942bb568c5548a12d8103751233R34 |
@Akryum that one does work! By the way I've just regenerated a project with |
I scaffolded a vue-cli 3 app about ~2 weeks ago and my module.exports = {
moduleFileExtensions: ["js", "jsx", "json", "vue"],
transform: {
"^.+\\.vue$": "vue-jest",
".+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$":
"jest-transform-stub",
"^.+\\.jsx?$": "babel-jest"
},
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/src/$1"
},
snapshotSerializers: ["jest-serializer-vue"],
testMatch: [
"<rootDir>/(tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx))"
]
}; When I scaffolded a new app today, module.exports = {
moduleFileExtensions: ["js", "jsx", "json", "vue"],
transform: {
"^.+\\.vue$": "vue-jest",
".+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$":
"jest-transform-stub",
"^.+\\.jsx?$": "babel-jest"
},
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/src/$1"
},
snapshotSerializers: ["jest-serializer-vue"],
testMatch: [
"**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"
]
}; Note the difference between the testMatch array. |
@kevinhofmaenner that is what vue-cli-plugin-unit-jest |
@mario-d-s - correct, the sample app I spun up yesterday was using |
For people having this issue, the latest version of Jest doesn't like the Use something like this instead:
Breaking changes like this would be nice if Jest warned you that the devs decided to implement a breaking change, instead of just giving cryptic errors when the developer does nothing wrong. Stuff like this makes all Jest 22 and previous source code that includes a jest.config.js file broken, for example. How is this good for the community? |
@onexdata Really it would be nice if the documentation would cover this somehow. I tried edit: |
@allochi I try it now I've got this :
|
Version
3.0.0-rc.3
Reproduction link
https://would-not-be-useful.com could not find a good way to do this - I think it must be related to some other setting.
Steps to reproduce
vue create test_app -> choose babel and jest
What is expected?
It runs HelloWorld.spec.js
What is actually happening?
It does not find the test
MacOS 10.13.2 High Sierra
Happening on another machine (not sure of the macOS version for it, but it's high sierra). I can check the version tomorrow. I tried using both npm and yarn, and jest directly.
I tried both with jest config in package.json and standalone.
Also I cannot specify either:
HOWEVER git cloning a project scaffolded on another PC works somehow.
Other projects on my machine are using jest no problem. Not sure what's going on. Any ideas?
The text was updated successfully, but these errors were encountered: