From d387f9f1fa323c0ef186d73c218457dfbbef9e5b Mon Sep 17 00:00:00 2001 From: James Date: Tue, 2 Apr 2024 10:01:47 -0400 Subject: [PATCH] chore: working pattern for debugging e2e and int --- test/helpers/initPayloadE2ENoConfig.ts | 3 +++ test/{setup.js => helpers/startMemoryDB.ts} | 0 test/jest.config.js | 2 +- test/playwright.config.ts | 6 ------ 4 files changed, 4 insertions(+), 7 deletions(-) rename test/{setup.js => helpers/startMemoryDB.ts} (100%) diff --git a/test/helpers/initPayloadE2ENoConfig.ts b/test/helpers/initPayloadE2ENoConfig.ts index b95a11f22..278fd23e9 100644 --- a/test/helpers/initPayloadE2ENoConfig.ts +++ b/test/helpers/initPayloadE2ENoConfig.ts @@ -8,6 +8,7 @@ import type { GeneratedTypes } from './sdk/types.js' import { createTestHooks } from '../testHooks.js' import { PayloadTestSDK } from './sdk/index.js' +import startMemoryDB from './startMemoryDB.js' type Args = { dirname: string @@ -29,6 +30,8 @@ export async function initPayloadE2ENoConfig>({ process.env.PORT = String(port) const serverURL = `http://localhost:${port}` + await startMemoryDB() + // @ts-expect-error const app = nextImport({ dev: true, diff --git a/test/setup.js b/test/helpers/startMemoryDB.ts similarity index 100% rename from test/setup.js rename to test/helpers/startMemoryDB.ts diff --git a/test/jest.config.js b/test/jest.config.js index ffc6eef5b..188c3c621 100644 --- a/test/jest.config.js +++ b/test/jest.config.js @@ -16,7 +16,7 @@ const customJestConfig = { }, reporters: ['default', ['github-actions', { silent: false }], 'summary'], testEnvironment: 'node', - globalSetup: path.resolve(dirname, 'setup.ts'), + globalSetup: path.resolve(dirname, './helpers/startMemoryDB.ts'), testMatch: ['/**/*int.spec.ts'], testTimeout: 90000, transform: { diff --git a/test/playwright.config.ts b/test/playwright.config.ts index c142aa333..85218d8ab 100644 --- a/test/playwright.config.ts +++ b/test/playwright.config.ts @@ -1,9 +1,4 @@ import { defineConfig } from '@playwright/test' -import path from 'path' -import { fileURLToPath } from 'url' - -const filename = fileURLToPath(import.meta.url) -const dirname = path.dirname(filename) export const EXPECT_TIMEOUT = 45000 export const POLL_TOPASS_TIMEOUT = EXPECT_TIMEOUT * 4 // That way expect.poll() or expect().toPass can retry 4 times. 4x higher than default expect timeout => can retry 4 times if retryable expects are used inside @@ -18,7 +13,6 @@ export default defineConfig({ trace: 'retain-on-failure', video: 'retain-on-failure', }, - globalSetup: path.resolve(dirname, 'setup.js'), expect: { timeout: EXPECT_TIMEOUT, },