-
Notifications
You must be signed in to change notification settings - Fork 157
Allow option to configure babelrc location for vue-jest #66
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
Agreed. We should use a jest global to get the location, similarly to how ts-jest does it—https://github.com/kulshekhar/ts-jest/blob/master/src/preprocessor.ts#L17 You can pass a global in in the Jest config object: {
"jest": {
"globals": {
"vue-jest": {
"babelRcFile": "babelrc.json"
}
}
}
} |
Same problem here (using yarn workspaces and would like to have only one .babelrc file to maintain). I think the priority is to look for a .babelrc file the same way Babel does it : Source: https://babeljs.io/docs/usage/babelrc/#lookup-behavior |
We currently use the find-babel-config package to get the .babelrc using the root directory(https://github.com/vuejs/vue-jest/blob/master/lib/load-babel-config.js#L21). We could change this to use the file directory instead, like you suggest. |
Sorry, why are you passing a depth of 0 to findBabelConfig.sync(process.cwd(), 0). That makes it only look in the current working directory; when it should recurse down. |
Now searches with a depth of infinity from the file path, as described in vuejs#66.
Is this currently an option? Currently running into the issue where vue-jest cannot find my .babelrc file when vue-jest's install directory is not within referencing directory.
example:
lerna-repo
-babelrc
-node_modules -> contains-vue jest
-lerna packages
--myComponent
--jestConfiguration
inside my jestConfiguration is a reference to the workspace vue-jest:
transform: {
'.*\.(vue)$': "../node_modules/vue-jest"
}
running the above fails because vue-jest cannot find my babelrc file. however, this works:
example:
lerna-repo
-babelrc
-node_modules -> contains-vue jest
-lerna packages
--myComponent
--jestConfiguration
--babelrc
to get around this, i am linking the parent babelrc file and removing it within npm lifecycle scripts.
version on npm is 5.6.0 and node is 8.9.4
The text was updated successfully, but these errors were encountered: