From 7ba787f8ab50d3fcd1c5308e0b088412f8ae49a4 Mon Sep 17 00:00:00 2001 From: Bricks666 Date: Tue, 27 Aug 2024 00:12:31 +0300 Subject: [PATCH] fix tests timezone --- configs/tests/global-setup.ts | 3 +++ src/shared/ui/date-time/__snapshots__/date-time.spec.tsx.snap | 4 ++-- vitest.config.ts | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 configs/tests/global-setup.ts diff --git a/configs/tests/global-setup.ts b/configs/tests/global-setup.ts new file mode 100644 index 00000000..8aff2acd --- /dev/null +++ b/configs/tests/global-setup.ts @@ -0,0 +1,3 @@ +export const setup = () => { + process.env.TZ = 'UTC'; +}; diff --git a/src/shared/ui/date-time/__snapshots__/date-time.spec.tsx.snap b/src/shared/ui/date-time/__snapshots__/date-time.spec.tsx.snap index 88641f50..6fff5549 100644 --- a/src/shared/ui/date-time/__snapshots__/date-time.spec.tsx.snap +++ b/src/shared/ui/date-time/__snapshots__/date-time.spec.tsx.snap @@ -3,8 +3,8 @@ exports[`shared/ui/date-time/date-time > should render time element with formated time 1`] = ` diff --git a/vitest.config.ts b/vitest.config.ts index 1e846e02..fe6bd2e5 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -6,6 +6,7 @@ export default defineConfig({ test: { environment: 'jsdom', setupFiles: [path.resolve(__dirname, './configs/tests/setup.ts')], + globalSetup: path.resolve(__dirname, './configs/tests/global-setup.ts'), include: ['./src/**/*.spec.{ts,tsx}'], clearMocks: true, globals: true,