From: Jérôme Benoit Date: Mon, 18 Nov 2024 13:41:03 +0000 (+0100) Subject: test: fix CI failure X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=87a4259551eb51e3565b14343dbdf74cc97db343;p=e-mobility-charging-stations-simulator.git test: fix CI failure Signed-off-by: Jérôme Benoit --- diff --git a/scripts/runtime.js b/scripts/runtime.js index d67b07ff..202187db 100644 --- a/scripts/runtime.js +++ b/scripts/runtime.js @@ -12,7 +12,7 @@ const isNode = globalThis.process?.release?.name === 'node' // eslint-disable-next-line n/no-unsupported-features/node-builtins const isWorkerd = globalThis.navigator?.userAgent === 'Cloudflare-Workers' // eslint-disable-next-line n/no-unsupported-features/node-builtins -const isBrowser = !!globalThis.navigator +const isBrowser = !!globalThis.window && !!globalThis.navigator export const runtime = (() => { if (isBun) return JSRuntime.bun diff --git a/tests/utils/Utils.test.ts b/tests/utils/Utils.test.ts index d7aebaca..c88baa0f 100644 --- a/tests/utils/Utils.test.ts +++ b/tests/utils/Utils.test.ts @@ -8,7 +8,7 @@ import { satisfies } from 'semver' import type { TimestampedData } from '../../src/types/index.js' -import { runtime, runtimes } from '../../scripts/runtime.js' +import { JSRuntime, runtime } from '../../scripts/runtime.js' import { Constants } from '../../src/utils/Constants.js' import { clone, @@ -296,7 +296,7 @@ await describe('Utils test suite', async () => { const date = new Date() expect(clone(date)).toStrictEqual(date) expect(clone(date) === date).toBe(false) - if (runtime === runtimes.node && satisfies(version, '>=22.0.0')) { + if (runtime === JSRuntime.node && satisfies(version, '>=22.0.0')) { const url = new URL('https://domain.tld') expect(() => clone(url)).toThrow(new Error('Cannot clone object of unsupported type.')) }