Skip to content

Commit c58e7fe

Browse files
committed
Enable jest to work
1 parent a6579f6 commit c58e7fe

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/useIsDark/client.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ import { data_fr_scheme, data_fr_theme, rootColorSchemeStyleTagId } from "./cons
77
export type ColorScheme = "light" | "dark";
88

99
const $clientSideIsDark = createStatefulObservable<boolean>(() => {
10+
if (typeof process === "object" && process.env.JEST_WORKER_ID !== undefined) {
11+
return false;
12+
}
13+
1014
throw new Error(
1115
[
12-
"react-dsfr not initialized",
16+
"react-dsfr not initialized.",
1317
"Refer to the documentation for setup instructions",
1418
"If it used to work but after an update you're getting this error",
1519
"it usually means that you have multiple copies of @codegouvfr/react-dsfr in your node_modules",

0 commit comments

Comments
 (0)