Skip to content

Commit

Permalink
fix(cli): mock matchMedia window function (#6472)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgulseth authored and rexxars committed Apr 26, 2024
1 parent 34a1ae6 commit ea715e8
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ const getFakeGlobals = (basePath: string) => ({
InputEvent: global.window?.InputEvent,
customElements: global.window?.customElements,
ResizeObserver: global.window?.ResizeObserver || ResizeObserver,
matchMedia:
global.window?.matchMedia ||
(() => ({
matches: false,
media: '',
onchange: null,
})),
})

function provideFakeGlobals(basePath: string): () => void {
Expand Down

0 comments on commit ea715e8

Please sign in to comment.