-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
unit test failing #1131
Comments
I can't, that's a preset you saved yourself ;) However I reproduced the selected options, and can't reproduce this, the tests pass just fine. Can you provide any more information? Like your setup, or a real repository with the failing code? Have you tried re-installing the error message indicates that the first babel plugin we add with the @vue/babel-preset-app preset exports an invalid property
So weh should have to use |
` yves@Yvess-Mac-mini myprojectTEST (master) $ rm -R node_modules yves@Yvess-Mac-mini myprojectTEST (master) $ yarn test Test Suites: 1 passed, 1 total re-building node_modules solved the issue ... I don't understand what happen .. but at leats , it's testing fine .. thanks for your prompt attention to it |
just for info .. I compared the 2 package.json the only difference I can see , is in the failing one , using @vue/prettier in eslintConfig
|
This is still an issue, is there a solution? |
the OP stated:
So if you have a similar problem, please open a new issue with a proper reproduction of the problem. |
I got the same exact same problem as well. Is it back? @Erwin16 does this still work with updated packages? |
Might be a false positive from my side. I have an app based on |
This issue started when I switched to Vue CLI 3 beta 10 (with Babel 7 beta). Some other packages (like Cypress webpack preprocessor) were using Babel 6. Manual update to Babel 7 in these packages fixed it. Different Babel versions do not live together well. |
The solution for me was switching back to using |
Running basic jest unit tests with npm and the latest beta of vue-cli. Same error that others are reporting. I nuked the whole node_modules directory and reinstalled, but with no change.
|
Have the exact same problem. :( Just run |
Given the repro above, should this be reopened? Also running into this. |
@manico can you open a new issue with the repro steps? I believe that's what @LinusBorg asked for after it was closed. i'm also having the same issue, but would be best to start a new issue with your reproduction steps so it can get resolved. |
It is the same case as the issue described here. |
EDIT: Went down to node versionn 9.0.0 and it worked. :) On my local Windows machine the test are passing just fine but on CircleCI I get the following error:
I am using 3.0.0-beta.15 and Node version 9.2.0 |
Same Here :(
Node: 10.5 (also tried on 8.9.4) |
same problem here with Vue-cli 3.0.0-rc.3 I am using this in a Monorepo with Lerna and Yarn Workspaces. Deleting all node_modules folders and doing |
This issue is closed, and so far still no reproducion was provided. Please open a new issue with reproduction |
I tried a few different things: const vueApp = (context, options) => {
const preset = require('@vue/babel-preset-app')(context, options);
preset.plugins[0] = preset.plugins[0].default;
return preset;
};
module.exports = {
presets: [
vueApp,
'typescript'
]
} This gave the following error: Test suite failed to run
Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel.
at throwVersionError (node_modules/@babel/plugin-syntax-jsx/node_modules/@babel/helper-plugin-utils/lib/index.js:65:11)
at Object.assertVersion (node_modules/@babel/plugin-syntax-jsx/node_modules/@babel/helper-plugin-utils/lib/index.js:13:11)
at api (node_modules/@babel/plugin-syntax-jsx/lib/index.js:19:7) I am using Node 9.11 and I notice ts-jest depends on babel-core 6.26.3 "ts-jest": {
"version": "22.4.6",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-22.4.6.tgz",
"integrity": "sha512-kYQ6g1G1AU+bOO9rv+SSQXg4WTcni6Wx3AM48iHni0nP1vIuhdNRjKTE9Cxx36Ix/IOV7L85iKu07dgXJzH2pQ==",
"dev": true,
"requires": {
"babel-core": "6.26.3",
"babel-plugin-istanbul": "4.1.6",
"babel-plugin-transform-es2015-modules-commonjs": "6.26.2",
"babel-preset-jest": "22.4.4",
"cpx": "1.5.0",
"fs-extra": "6.0.0",
"jest-config": "22.4.4",
"lodash": "4.17.10",
"pkg-dir": "2.0.0",
"source-map-support": "0.5.6",
"yargs": "11.1.0"
},
// .... This is my current list of dependencies: "dependencies": {
"register-service-worker": "^1.4.1",
"vue": "^2.5.16",
"vue-loader": "^15.2.4",
"vue-router": "^3.0.1",
"vuex": "^3.0.1"
},
"devDependencies": {
"@babel/core": "^7.0.0-beta.47",
"@babel/plugin-syntax-jsx": "^7.0.0-beta.52",
"@babel/preset-typescript": "^7.0.0-beta.52",
"@types/jest": "^22.2.3",
"@vue/babel-preset-app": "^3.0.0-rc.3",
"@vue/cli-plugin-babel": "^3.0.0-beta.15",
"@vue/cli-plugin-e2e-nightwatch": "^3.0.0-beta.15",
"@vue/cli-plugin-pwa": "^3.0.0-beta.15",
"@vue/cli-plugin-typescript": "^3.0.0-beta.15",
"@vue/cli-plugin-unit-jest": "^3.0.0-beta.15",
"@vue/cli-service": "^3.0.0-beta.15",
"@vue/test-utils": "^1.0.0-beta.20",
"autoprefixer-loader": "^3.2.0",
"babel-loader": "^7.1.5",
"babel-preset-es2015": "^6.24.1",
"css-loader": "^0.28.11",
"file-loader": "^1.1.11",
"node-sass": "^4.9.1",
"sass-loader": "^7.0.3",
"style-loader": "^0.21.0",
"ts-jest": "^22.4.6",
"vue-style-loader": "^4.1.0",
"vue-template-compiler": "^2.5.16",
"webpack": "^4.15.1",
"webpack-cli": "^3.0.8",
"webpack-dev-server": "^3.1.4",
"webpack-serve": "^1.0.4"
}, I tried updating ts-jest to ^23, but a lot of the jest modules depend on babel-register and babel-core 6.26.3. Will update when I find a solution. |
Yeah to me it seems like jest-config latest (23.3.x) as of this post, does not work with @babel/etc ^7: https://github.com/facebook/jest/blob/v23.3.0/package.json So typescript + jest is a no go with the latest vue-cli config. ... Actually, there is an issue with mocha+chai as well (I am able to replicate this error with the jest option after installing babel-7-jest. Here is a repro: > vue-cli-service test:unit
/Users/arbolista/Code/tutorials/vue/my-third-app/node_modules/hosted-git-info/index.js:73
if (!(ex instanceof URIError)) throw ex
^
TypeError: Cannot read property 'replace' of null
at /Users/blah/Code/tutorials/vue/my-third-app/node_modules/hosted-git-info/index.js:61:62
at Array.map (native)
at fromUrl (/Users/blah/Code/tutorials/vue/my-third-app/node_modules/hosted-git-info/index.js:45:39)
at Function.module.exports.fromUrl (/Users/arbolista/Code/tutorials/vue/my-third-app/node_modules/hosted-git-info/index.js:32:18)
at Object.<anonymous> (/Users/blah/Code/tutorials/vue/my-third-app/node_modules/normalize-package-data/lib/fixer.js:150:36)
at Array.forEach (native)
at Object.<anonymous> (/Users/blah/Code/tutorials/vue/my-third-app/node_modules/normalize-package-data/lib/fixer.js:144:31)
at Array.forEach (native)
at Object.fixDependencies (/Users/blah/Code/tutorials/vue/my-third-app/node_modules/normalize-package-data/lib/fixer.js:137:41)
at /Users/blah/Code/tutorials/vue/my-third-app/node_modules/normalize-package-data/lib/normalize.js:32:38 https://github.com/erichulburd/vue-cli-typescript-test-issues |
I was also facing the same issue. I corrected it by simply nuking my node_modules and package.json, and then updating the devDependencies with the latest values spit out in a fresh project created via CLI... these being:
Worked like a charm after that. |
@haverchuck - thanks for sharing :) - "babel-core": "7.0.0-bridge.0" was not included by default at my side and adding it manually solved the issue. |
remove: It works. |
Nice @Max-0n, that worked for me. |
Version
3.0.0-beta.6
Reproduction link
https://codesandbox.io/s/vue
Steps to reproduce
vue create myproject
Vue CLI v3.0.0-beta.6
? Please pick a preset: full (vue-router, vuex, sass, babel, pwa, eslint, unit-j
est, e2e-nightwatch)
select full
🎉 Successfully created project myproject.
cd myproject
What is expected?
vue-cli-service test passing without error
What is actually happening?
FAIL tests/unit/HelloWorld.spec.js
● Test suite failed to run
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 10.668s
Ran all test suites.
ERROR jest exited with code 1.
error Command failed with exit code 1.
The text was updated successfully, but these errors were encountered: