Skip to content

Commit

Permalink
fix: change the way we initialize isBrowser
Browse files Browse the repository at this point in the history
  • Loading branch information
panvourtsis authored Nov 3, 2023
1 parent f3b268f commit 1b9f3d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/jest/src/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow

const isBrowser = typeof document !== 'undefined'
const isBrowser = (document) => typeof document !== 'undefined'

Check failure on line 3 in packages/jest/src/utils.js

View workflow job for this annotation

GitHub Actions / Linting

Replace `(document)` with `document`

function last(arr) {
return arr.length > 0 ? arr[arr.length - 1] : undefined
Expand Down Expand Up @@ -260,7 +260,7 @@ export function getStylesFromClassNames(
}

export function getStyleElements(): Array<HTMLStyleElement> {
if (!isBrowser) {
if (!isBrowser(document)) {
throw new Error(
'jest-emotion requires jsdom. See https://jestjs.io/docs/en/configuration#testenvironment-string for more information.'
)
Expand Down

0 comments on commit 1b9f3d5

Please sign in to comment.