Skip to content

Commit c21c0ef

Browse files
authoredSep 19, 2023
fix(happy-dom): catch errors in happy-dom (#4140)
1 parent b50cf7a commit c21c0ef

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
 

‎packages/vitest/src/integrations/env/happy-dom.ts

+9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ export default <Environment>({
99
const { Window } = await importModule('happy-dom') as typeof import('happy-dom')
1010
const win = new Window({
1111
...happyDOM,
12+
console: (console && globalThis.console) ? globalThis.console : undefined,
1213
url: happyDOM.url || 'http://localhost:3000',
14+
settings: {
15+
...happyDOM.settings,
16+
disableErrorCapturing: true,
17+
},
1318
}) as any
1419

1520
// TODO: browser doesn't expose Buffer, but a lot of dependencies use it
@@ -36,6 +41,10 @@ export default <Environment>({
3641
...happyDOM,
3742
console: (console && global.console) ? global.console : undefined,
3843
url: happyDOM.url || 'http://localhost:3000',
44+
settings: {
45+
...happyDOM.settings,
46+
disableErrorCapturing: true,
47+
},
3948
})
4049

4150
const { keys, originals } = populateGlobal(global, win, { bindFunctions: true })

0 commit comments

Comments
 (0)
Please sign in to comment.