-
Notifications
You must be signed in to change notification settings - Fork 27
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
Processing vue files from node_modules
#10
Comments
I'll try to dig into it today/tomorrow. Looks like there's an issue with the jest config... Can you post here a verbose example of your --debug ? |
Yep, here you go. > jest --debug
jest version = 19.0.2
test framework = jasmine2
config = {
"automock": false,
"bail": false,
"browser": false,
"cacheDirectory": "/tmp/jest",
"clearMocks": false,
"coveragePathIgnorePatterns": [
"/node_modules/"
],
"coverageReporters": [
"json",
"text",
"lcov",
"clover"
],
"expand": false,
"globals": {},
"haste": {
"providesModuleNodeModules": []
},
"moduleDirectories": [
"node_modules"
],
"moduleFileExtensions": [
"js",
"vue"
],
"moduleNameMapper": [
[
"^@(.*)$",
"/home/jeremybush/code/card-rocket-web/src$1"
]
],
"modulePathIgnorePatterns": [],
"noStackTrace": false,
"notify": false,
"preset": null,
"resetMocks": false,
"resetModules": false,
"roots": [
"/home/jeremybush/code/card-rocket-web"
],
"snapshotSerializers": [],
"testEnvironment": "jest-environment-jsdom",
"testMatch": [],
"testPathIgnorePatterns": [
"/node_modules/"
],
"testRegex": "jest/.*",
"testResultsProcessor": null,
"testURL": "about:blank",
"timers": "real",
"transformIgnorePatterns": [
"/node_modules/"
],
"useStderr": false,
"verbose": null,
"watch": false,
"transform": [
[
"^.+\\.js$",
"/home/jeremybush/code/card-rocket-web/node_modules/babel-jest/build/index.js"
],
[
"^.+\\.vue$",
"/home/jeremybush/code/card-rocket-web/node_modules/jest-vue-preprocessor/index.js"
]
],
"rootDir": "/home/jeremybush/code/card-rocket-web",
"name": "2f6d8b20a2ee813721c618fac7abced7",
"setupFiles": [],
"testRunner": "/home/jeremybush/code/card-rocket-web/node_modules/jest-jasmine2/build/index.js",
"cache": true,
"watchman": true
} |
@zombor Still working on that had no chance to get to fix this yet, but I was experimenting and was able to reproduce the bug. It might be related to the "transform" config... I need to debug |
Cool, thanks for the heads up. With vue-octicon, there's some webpack config needed, I wonder if it's a similar thing with this: https://github.com/Justineo/vue-octicon#es-modules-with-npm--vue-loader-recommended |
Any update on this issue? also having the same problem. |
I've ended up just moving away from vue-octicon, so unfortunately I don't have a good answer. |
@zombor any luck on importing other |
I had the same problem with two node modules. I fixed it by using Here is part of my "moduleFileExtensions": [
"vue",
"js"
],
"moduleNameMapper": {
"^vue$": "vue/dist/vue.common.js",
"^@(.*)": "<rootDir>/src/$1",
".*\\.(less|css)$": "babel-jest"
},
"transform": {
".*\\.vue$": "<rootDir>/node_modules/jest-vue-preprocessor",
".*\\.js$": "<rootDir>/node_modules/babel-jest"
},
"transformIgnorePatterns": [
"node_modules/(?!vue-awesome|vue-quill-editor)"
] So to clarify what that regex exacly does:
|
I have found a similar issue (resolved) on another jest implementation for react slingshot. |
I have an example about vue-clap-button. In my vue project's .babelrc, I added the settings as below: Then, I want to use vue-clap- button in my jest script. I also repeated the upper settings in node_modules/vue-clap-button's .babelrc file. And it 's ok to run jest test. |
Hi, I'm having some trouble with processing vue files from npm package dependencies. Am I doing something wrong?
My current
package.json
config:In my test, I have an import like this:
And when I run my tests, it complains about:
The text was updated successfully, but these errors were encountered: