From 254ac407032bbb5869a4fe8977e7855ccaadd161 Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Thu, 5 Jun 2025 00:43:01 +0700 Subject: [PATCH] feat: add only param to e2e test fixtures --- apps/e2e/src/e2e.test.ts | 6 ++++-- apps/e2e/src/fixtures.ts | 4 ++-- apps/gateway/src/worker.ts | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/e2e/src/e2e.test.ts b/apps/e2e/src/e2e.test.ts index 7d69b207..56950008 100644 --- a/apps/e2e/src/e2e.test.ts +++ b/apps/e2e/src/e2e.test.ts @@ -18,7 +18,8 @@ const ky = defaultKy.extend({ for (const [i, fixtureSuite] of fixtureSuites.entries()) { const { title, fixtures } = fixtureSuite - describe(title, () => { + const describeFn = fixtureSuite.only ? describe.only : describe + describeFn(title, () => { let responseBody: any | undefined for (const [j, fixture] of fixtures.entries()) { @@ -32,7 +33,8 @@ for (const [i, fixtureSuite] of fixtureSuites.entries()) { const { snapshot = status >= 200 && status < 300 } = fixture.response ?? {} - test( + const testFn = fixture.only ? test.only.sequential : test.sequential + testFn( `${i}.${j}: ${method} ${fixture.path}`, { timeout: fixture.timeout ?? 60_000 diff --git a/apps/e2e/src/fixtures.ts b/apps/e2e/src/fixtures.ts index b845c06e..bac0fbc8 100644 --- a/apps/e2e/src/fixtures.ts +++ b/apps/e2e/src/fixtures.ts @@ -5,7 +5,7 @@ export type E2ETestFixture = { timeout?: number /** @default false */ - // only?: boolean + only?: boolean request?: { /** @default 'GET' */ @@ -34,7 +34,7 @@ export type E2ETestFixtureSuite = { fixtures: E2ETestFixture[] /** @default false */ - // only?: boolean + only?: boolean } export const fixtureSuites: E2ETestFixtureSuite[] = [ diff --git a/apps/gateway/src/worker.ts b/apps/gateway/src/worker.ts index e672ecbe..2db3ad54 100644 --- a/apps/gateway/src/worker.ts +++ b/apps/gateway/src/worker.ts @@ -43,6 +43,7 @@ app.use(init) // Wrangler does this for us. TODO: Does this happen on prod? // app.use(accessLogger) + app.use(responseTime) app.all(async (ctx) => {