From 1b83a9b534d62e04ec0738e681f21a35d80f50d1 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 27 Sep 2022 14:53:24 +0100 Subject: [PATCH] fix(test-utils): respect `setupTimeout` --- packages/test-utils/src/context.ts | 2 +- packages/test-utils/src/setup/jest.ts | 2 +- packages/test-utils/src/setup/vitest.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/test-utils/src/context.ts b/packages/test-utils/src/context.ts index ad987d1ec97..0e8da939e7f 100644 --- a/packages/test-utils/src/context.ts +++ b/packages/test-utils/src/context.ts @@ -9,7 +9,7 @@ export function createTestContext (options: Partial): TestContext { testDir: resolve(process.cwd(), 'test'), fixture: 'fixture', configFile: 'nuxt.config', - setupTimeout: 60000, + setupTimeout: 120 * 1000, dev: !!JSON.parse(process.env.NUXT_TEST_DEV || 'false'), logLevel: 1, server: true, diff --git a/packages/test-utils/src/setup/jest.ts b/packages/test-utils/src/setup/jest.ts index 01a9f654386..b982e952475 100644 --- a/packages/test-utils/src/setup/jest.ts +++ b/packages/test-utils/src/setup/jest.ts @@ -8,7 +8,7 @@ export default async function setupJest (hooks: TestHooks) { // TODO: add globals existing check to provide better error message // @ts-expect-error jest types - test('setup', hooks.setup, 120 * 1000) + test('setup', hooks.setup, hooks.ctx.options.setupTimeout) // @ts-expect-error jest types beforeEach(hooks.beforeEach) // @ts-expect-error jest types diff --git a/packages/test-utils/src/setup/vitest.ts b/packages/test-utils/src/setup/vitest.ts index 5fa16f6d9ed..d55ece34389 100644 --- a/packages/test-utils/src/setup/vitest.ts +++ b/packages/test-utils/src/setup/vitest.ts @@ -5,7 +5,7 @@ export default async function setupVitest (hooks: TestHooks) { hooks.ctx.mockFn = vitest.vi.fn - vitest.beforeAll(hooks.setup, 120 * 1000) + vitest.beforeAll(hooks.setup, hooks.ctx.options.setupTimeout) vitest.beforeEach(hooks.beforeEach) vitest.afterEach(hooks.afterEach) vitest.afterAll(hooks.afterAll)