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: ReferenceError: Vue is not defined for v2.0.0 #1525
Comments
same issue here |
Maybe this solution will help #234 (comment) |
Now I faced the same issue in some of my projects which are using jest v28 with
When I manually remove the changes of #1484 from the |
@freakzlike Thank you! I tried it and found it works. I think this can be used as a temporary solution :) |
Is this a bug in test utils? Sounds like it's more related to Jest 28 and Vue Jest? |
The fix suggested by @pdsuwwz works 👍 |
This sounds like it is Jest/jsdom, and nothing something in Test Utils... going to close this, unless there's an obvious way to improve things on this end. |
I think the issue might be on our end. Jest by default uses |
Just normally runs in a Node.js environment (using CommonJS modules) so it should be using the https://github.com/vuejs/test-utils/blob/main/package.json#L14-L15 I don't think |
It uses browser field, because jest resolves to it for jsdom (since v28?) https://jestjs.io/docs/next/configuration#testenvironmentoptions-object |
Oh, I see. I do not think we can do anything about this here, though. Seems #1525 (comment) is the solution for now. |
A bit late to the party but just wanted to double check something regarding #1525 (comment) "fix", as I'm upgrading a codebase from jest26->29, using test-utils. I have
I have What am I missing to make jsdom features (aka browser window and other implementations) work in test-utils tests? |
Describe the bug
In the latest version (v2.0.0), the introduction of
@vue/test-utils
will result in an error.Minimal reproduction: https://github.com/pdsuwwz/vue-unit/pull/17/files
Related action: https://github.com/pdsuwwz/vue-unit/runs/6535330150?check_suite_focus=true
To Reproduce
Upgrade the version of
@vue/test-utils
fromv2.0.0-rc.21
tov2.0.0
https://www.npmjs.com/package/@vue/test-utils/v/2.0.0
Expected behavior
Unit test passed.
Related information:
@vue/test-utils
version: v2.0.0Vue
version: v3.2.35node
version: v14.19.2npm
(oryarn
) version: v6.14.17Additional context
The text was updated successfully, but these errors were encountered: