-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[Bug]: Jest transformIgnorePatterns can't transpile vee-validate with pnpm #12984
Comments
I encountered this yesterday. it's because pnpm installs libs to node_modules/.pnpm/vee-validate and symlinks them to the root. So this will work:
but I would also like to find a better solution where the transformIgnorePattern doesn't have to know about pnpm. |
I tried both of those but none seemed to work 😮💨 |
It could be the slash in the beginning
|
Would you mind sharing your |
I have a NX monorepo. so it's not really applicable to your setup, sorry |
https://github.com/theolavaux/jest-vee-validate-rules Here is a repro |
ran into this today migrating to transformIgnorePatterns: [
`node_modules/(?!(?:.pnpm/)?(${esmModules.join('|')}))`,
], https://codesandbox.io/s/jest-transformignorepattern-czh44p?file=/src/index.ts |
THANKS. worked like charm for me. Here is my config var esmModules = ['react-photoswipe-gallery', 'photoswipe'];
module.exports = {
preset: '../../jest.preset.js',
transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nrwl/next/babel'] }],
},
transformIgnorePatterns: [
// Before: 'node_modules/(?!(react-photoswipe-gallery|photoswipe)/)',
// "After:"
`node_modules/(?!(?:.pnpm/)?(${esmModules.join('|')}))`,
],
setupFilesAfterEnv: ['../../jest.setup.ts'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
}; |
Config issue, hopefully #13115 has made it clearer 🙂 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Version
28.1.1
Steps to reproduce
Expected behavior
I expect tests to pass
Actual behavior
What happened?
I have a Nuxt app that runs with pnpm and I'd like to test it using Jest and the vee-validate library.
I tried to add the option
transformIgnorePattern
insidejest.config.js
but it's not working at all.This is what I tried:
transformIgnorePatterns: ['/node_modules/(?!vee-validate/dist/rules)']
transformIgnorePatterns: ['/node_modules/(?!(.*vee-validate/dist/rules))/']
The only option that works for me is to import the UMD build but I lose all the benefit of tree-shaking.
Sources
logaretm/vee-validate#2310
#2081 (comment)
https://qiita.com/tamonmon/items/6392c1680ef498a8c816
Reproduction steps
Version
Vue.js 2.x and vee-validate 3.x
Relevant log output
Code of Conduct
Additional context
No response
Environment
The text was updated successfully, but these errors were encountered: