Skip to content

Commit

Permalink
fix(happy-dom): catch errors in happy-dom (#4140)
Browse files Browse the repository at this point in the history
  • Loading branch information
capricorn86 authored Sep 19, 2023
1 parent b50cf7a commit c21c0ef
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/vitest/src/integrations/env/happy-dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ export default <Environment>({
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
Expand All @@ -36,6 +41,10 @@ export default <Environment>({
...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 })
Expand Down

0 comments on commit c21c0ef

Please sign in to comment.