happy-dom
happy-dom copied to clipboard
ReferenceError: XMLHttpRequest is not defined
I try to use happy-dom jest env in a quasar project and am facing this error when jest hits the line with
import { installQuasarPlugin } from '@quasar/quasar-app-extension-testing-unit-jest';
stack trace
at Object.<anonymous> (node_modules/quasar/dist/quasar.esm.prod.js:6:22776)
at Object.<anonymous> (node_modules/@quasar/quasar-app-extension-testing-unit-jest/src/helpers/install-quasar-plugin.ts:4:1)
at Object.<anonymous> (node_modules/@quasar/quasar-app-extension-testing-unit-jest/src/helpers/index.ts:1:1)
My guess, this is not used but has a reference in the dist file.
I have a similar problem with using the logrocket package.
ReferenceError: XMLHttpRequest is not defined
❯ new e evalmachine.<anonymous>:1:77916
❯ script.onload node_modules/.pnpm/[email protected]/node_modules/logrocket/dist/build.umd.js:3641:27
3639| // causing _LRlogger to be undefined. Let's make sure its there first.
3640| if (typeof window._LRLogger === 'function') {
3641| instance.onLogger(new window._LRLogger({
| ^
3642| sdkVersion: sdkVersion
3643| }));
Even though it doesn't get used, just importing the package tries to use XMLHttpRequest
Thanks for reporting @sschneider-ihre-pvs! 🙂
We have now added support for XMLHttpRequest.
You can read more about the release here: https://github.com/capricorn86/happy-dom/releases/tag/v7.8.0
he hey, some xmas gifts come early :D