From 77d1cf4091b6a7e963c7625e24c3e798dcada146 Mon Sep 17 00:00:00 2001 From: Jonny Gerig Meyer Date: Thu, 7 Nov 2024 16:46:00 -0500 Subject: [PATCH] Try fake timer --- test/routes/page.spec.ts | 1 + vitest.config.ts | 14 +------------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/test/routes/page.spec.ts b/test/routes/page.spec.ts index 1d13fe1..674511e 100644 --- a/test/routes/page.spec.ts +++ b/test/routes/page.spec.ts @@ -8,6 +8,7 @@ interface TestContext { describe('Page', () => { beforeEach((context) => { + vi.useFakeTimers(); context.result = render(Page); }); diff --git a/vitest.config.ts b/vitest.config.ts index c28a037..3283be1 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,5 +1,4 @@ import { svelteTesting } from '@testing-library/svelte/vite'; -import type { PluginOption } from 'vite'; import { coverageConfigDefaults, defineConfig, @@ -8,24 +7,13 @@ import { import viteConfig from './vite.config.js'; -// Run tests in browser environment -// https://github.com/testing-library/svelte-testing-library/issues/222 -const vitestBrowserConditionPlugin: PluginOption = { - name: 'vite-plugin-vitest-browser-condition', - config({ resolve }) { - if (process.env.VITEST) { - resolve?.conditions?.unshift('browser'); - } - }, -}; - /** * @see https://vitest.dev/config/#configuration */ export default mergeConfig( viteConfig, defineConfig({ - plugins: [vitestBrowserConditionPlugin, svelteTesting()], + plugins: [svelteTesting()], test: { include: ['./test/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], globals: true,