-
Notifications
You must be signed in to change notification settings - Fork 257
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: XMLSerializer problems #1253
Comments
@maerteijn Thanks for the repro. We have some regressions in rc.18 (I personally still use rc.17) @xanf WDYT? This is weirdly not breaking any tests in VTU, but maybe there are no tests with multi-root components. It looks like there https://github.com/jsdom/w3c-xmlserializer that we might use? |
@cexbrayat that's weird, I will take a look today. Using w3c-xmlserializer feels like a good option In any case, happy to have repro! |
Ok sorry guys, the original report and assumptions I did that
I do have other problems with the |
@maerteijn thank you for keeping us updated. I will take a look today :) |
I was not able to repro this in our code base, copy pasted the test from the OP: |
I tried to analyse this. The error gets thrown because Unfortunally I was not able to get this running, but maybe this helps someone by digging into this. |
With https://github.com/maerteijn/xmlserializer-problems-testcase/actions/runs/2091906179 See the branch: https://github.com/maerteijn/xmlserializer-problems-testcase/tree/jsdom-v8.0.0-jsdom-global-v3.0.2 |
If you try to force the dependency resolution (using yarn "resolutions" for example), and set jsdom to v19 and global-jsdom to v8, do you still reproduce the issue? It may be worth opening an issue in the CLI rather than here, as I suspect we won't be able to help much if this is a dependency issue. |
Ok, so after some fiddling around I can tell you more what causes the issue:
When I manually patch the global jsdom-global: require("jsdom-global")()
global.XMLSerializer = window.XMLSerializer global-jsdom: require("global-jsdom/register")
global.XMLSerializer = window.XMLSerializer then the correct So And there should be some documentation regarding seting up |
Wow, awesome bug hunt. Sounds like it only happens w/ certain versions. Rather than doc it, should we just add a try/catch and handle both cases, so users don't need to think too much about it? |
I just noticed this in the source of the cli-plugin-unit-mocha package: https://github.com/vuejs/vue-cli/blob/master/packages/%40vue/cli-plugin-unit-mocha/setup.js There are already some similar workarounds added for missing globals like vuejs/core#2943 As I guess I should make a PR for |
@maerteijn I agree, I think the CLI is the best place to fix it, as it looks like this issue only occurs with this exact setup. We can probably even transfer the issue there as it would make more sense? |
@cexbrayat Yes I think so. It's not an issue with |
Ok - closing this one off, since it's not a bug here and there's no action required (in VTU). |
A PR with a |
Hi, I catch this error in 2.0.0-rc.20 but in 2.0.0-rc.7 all is good
|
@AndreiSoroka thank you for reproduction. Let ne take a closer look |
Describe the bug
Since release
2.0.0-rc.18
I sometimes encounter the following error when running my testsuite with JSDOM:This does not happen with
2.0.0-rc.17
. There are more issues with XMLSerializer, but this one is reproducable in a separate testcase. I can add more tests for the other issues when requested.To Reproduce
See the repo here: https://github.com/maerteijn/xmlserializer-problems-testcase
See the CI result here: https://github.com/maerteijn/xmlserializer-problems-testcase/actions/runs/1720099564
Expected behavior
That the test won't fail due to the use of
XMLSerializer
. I have the feeling that it has a large impact on howvue-test-utils
responds compared to previous versions.Related information:
@vue/test-utils
version: 2.0.0-rc.18Vue
version: 3.2.xJSDOM
version: 16.7 until v19.0node
version: v16.13.0npm
(oryarn
) version: 8.1.0The text was updated successfully, but these errors were encountered: