-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Vue compat with Jest: "TypeError: decode_js.EntityDecoder is not a constructor" #10609
Comments
Update: I was mistaken about versions. My |
Is there any update on this issue further, I am also getting this issue in my project. |
The problem is caused by incompatible dependency versions, I tried to use npm, |
usually I don't express any emotion... and pleas don't get me wrong I don't mean to blame anyone. I came to this issue because of:
which - out of a sudden - spits out after a fresh docker build of a nuxt project opting in to enable vue runtime compiler and... yes, of course working fine on local dev with node 20.12.2 but not with docker build. All builds (2 years+) without that So:
the error remained the same, the line (with context) reads like:
with (line 1483):
aha, now... what? how much abstraction is going on here - and causing confusion. All I wanted is to transfere a God knows I am a big advocate for js and vue (in favor of react) or nuxt (in favor of next) etc. - but this time I wich to be writing perl cgi as we did 20years ago. 10min done. ...sorry no rant at all just frustration. Hope to find solution by myself over the weekend. |
...for reference (as @lzl0304 stated) the output of |
HA! removed all and every package that required an `entities? version < 4.5 (thanks again @lzl0304) and violá build & run works as I were running local dev in production... conclusion?
came here from #10148 (for ref) |
Fixes vuejs#10609 Unlike the `vue` package, direct dependencies of `@vue/compat` are not externalized: https://github.com/vuejs/core/blob/201936f9a3909ae9dca4e131e1f5ad5a1c0feb77/rollup.config.js#L274 So it depends on `entities` directly in its CJS build, unlike the `vue` one which indirectly depends on it via `@vue/compiler-core`. So `entities` must be explicitly added to `@vue/compat` deps to avoid incorrect dependency resolution due to different `node_modules` layouts, such as in vuejs#10609.
Fixes vuejs#10609 Unlike the `vue` package, direct dependencies of `@vue/compat` are not externalized: https://github.com/vuejs/core/blob/201936f9a3909ae9dca4e131e1f5ad5a1c0feb77/rollup.config.js#L274 So it depends on `entities` directly in its CJS build, unlike the `vue` one which indirectly depends on it via `@vue/compiler-core`. So `entities` must be explicitly added to `@vue/compat` deps to avoid incorrect dependency resolution due to different `node_modules` layouts, such as in vuejs#10609 (comment)
Vue version
3.4.21 (with @vue/compat 3.4.21)
Link to minimal reproduction
https://stackblitz.com/edit/vue2-jest-8qoex3?file=jest.config.js&view=editor
Steps to reproduce
What is expected?
I would like to run unit tests with Vue Test Utils, while on the migration build. My application has Vue 2 dependencies which cause unit tests to fail when they are run with Vue 3. I would expect to be able to use the migration build to fix this by aliasing
vue
to@vue/compat
viamoduleNameMapper
. (This is the approach recommended by vue-test-utils-compat though the minimal reproduction uses latest@vue/test-utils
.)What is actually happening?
Running tests with
moduleNameMapper: { '^vue$': '@vue/compat' }
causes the following TypeError:System Info
System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 18.18.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 10.2.3 - /usr/local/bin/npm pnpm: 8.15.3 - /usr/local/bin/pnpm npmPackages: vue: ^3.3.4 => 3.4.21
Any additional comments?
This is the same error as in #10148 though it doesn't affect me at build- or runtime, only in Jest.
The text was updated successfully, but these errors were encountered: