diff --git a/packages/vitest/src/integrations/env/happy-dom.ts b/packages/vitest/src/integrations/env/happy-dom.ts index 21936fafe990..9efedcbe47fa 100644 --- a/packages/vitest/src/integrations/env/happy-dom.ts +++ b/packages/vitest/src/integrations/env/happy-dom.ts @@ -34,6 +34,7 @@ export default ({ const { Window, GlobalWindow } = await importModule('happy-dom') as typeof import('happy-dom') const win = new (GlobalWindow || Window)({ ...happyDOM, + console: (console && global.console) ? global.console : undefined, url: happyDOM.url || 'http://localhost:3000', })