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 Apr 24, 2024
1 parent 3a0d948 commit e1cd86d
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 e1cd86d

Please sign in to comment.