diff --git a/packages/vitest/src/integrations/env/happy-dom.ts b/packages/vitest/src/integrations/env/happy-dom.ts index 9efedcbe47fa..5bcb794cb561 100644 --- a/packages/vitest/src/integrations/env/happy-dom.ts +++ b/packages/vitest/src/integrations/env/happy-dom.ts @@ -9,7 +9,12 @@ export default ({ const { Window } = await importModule('happy-dom') as typeof import('happy-dom') const win = new Window({ ...happyDOM, + console: (console && globalThis.console) ? globalThis.console : undefined, url: happyDOM.url || 'http://localhost:3000', + settings: { + ...happyDOM.settings, + disableErrorCapturing: true, + }, }) as any // TODO: browser doesn't expose Buffer, but a lot of dependencies use it @@ -36,6 +41,10 @@ export default ({ ...happyDOM, console: (console && global.console) ? global.console : undefined, url: happyDOM.url || 'http://localhost:3000', + settings: { + ...happyDOM.settings, + disableErrorCapturing: true, + }, }) const { keys, originals } = populateGlobal(global, win, { bindFunctions: true })