From b6cb30bedb75ab5bc5057a819c91323013194cd3 Mon Sep 17 00:00:00 2001 From: Michael Cousins Date: Sun, 8 Dec 2024 12:52:41 -0500 Subject: [PATCH] test(jest): skip auto-cleanup tests in Jest --- src/__tests__/auto-cleanup.test.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/__tests__/auto-cleanup.test.js b/src/__tests__/auto-cleanup.test.js index 803001e..7962925 100644 --- a/src/__tests__/auto-cleanup.test.js +++ b/src/__tests__/auto-cleanup.test.js @@ -1,8 +1,13 @@ import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest' -const globalAfterEach = vi.fn() +import { IS_JEST } from './utils.js' + +// TODO(mcous, 2024-12-08): clearing module cache and re-importing +// in Jest breaks Svelte's environment checking heuristics. +// Re-implement this test in a more accurate environment, without mocks. +describe.skipIf(IS_JEST)('auto-cleanup', () => { + const globalAfterEach = vi.fn() -describe('auto-cleanup', () => { beforeEach(() => { vi.resetModules() globalThis.afterEach = globalAfterEach