Skip to content

Commit 578c7e6

Browse files
Merge master into feature/sdkv3
2 parents 9e8ea9e + 75eb516 commit 578c7e6

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

packages/amazonq/test/e2e/amazonq/framework/jsdomInjector.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,24 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import { JSDOM } from 'jsdom'
6+
import { JSDOM, VirtualConsole } from 'jsdom'
77

8+
/**
9+
* JSDOM is used to help hoist MynahUI to running in a node environment vs in the browser (which is what it's made for)
10+
*/
811
export function injectJSDOM() {
9-
/**
10-
* JSDOM is used to help hoist MynahUI to running in a node environment vs in the browser (which is what it's made for)
11-
*/
12+
const virtualConsole = new VirtualConsole()
13+
virtualConsole.on('error', (error) => {
14+
// JSDOM can't load scss from mynah UI, just skip it
15+
if (!error.includes('Could not parse CSS stylesheet')) {
16+
console.error(error)
17+
}
18+
})
19+
1220
const dom = new JSDOM(undefined, {
1321
pretendToBeVisual: true,
1422
includeNodeLocations: true,
23+
virtualConsole,
1524
})
1625
global.window = dom.window as unknown as Window & typeof globalThis
1726
global.document = dom.window.document

0 commit comments

Comments
 (0)