kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
feat: add only param to e2e test fixtures
rodzic
7c527cb61b
commit
254ac40703
|
@ -18,7 +18,8 @@ const ky = defaultKy.extend({
|
||||||
for (const [i, fixtureSuite] of fixtureSuites.entries()) {
|
for (const [i, fixtureSuite] of fixtureSuites.entries()) {
|
||||||
const { title, fixtures } = fixtureSuite
|
const { title, fixtures } = fixtureSuite
|
||||||
|
|
||||||
describe(title, () => {
|
const describeFn = fixtureSuite.only ? describe.only : describe
|
||||||
|
describeFn(title, () => {
|
||||||
let responseBody: any | undefined
|
let responseBody: any | undefined
|
||||||
|
|
||||||
for (const [j, fixture] of fixtures.entries()) {
|
for (const [j, fixture] of fixtures.entries()) {
|
||||||
|
@ -32,7 +33,8 @@ for (const [i, fixtureSuite] of fixtureSuites.entries()) {
|
||||||
const { snapshot = status >= 200 && status < 300 } =
|
const { snapshot = status >= 200 && status < 300 } =
|
||||||
fixture.response ?? {}
|
fixture.response ?? {}
|
||||||
|
|
||||||
test(
|
const testFn = fixture.only ? test.only.sequential : test.sequential
|
||||||
|
testFn(
|
||||||
`${i}.${j}: ${method} ${fixture.path}`,
|
`${i}.${j}: ${method} ${fixture.path}`,
|
||||||
{
|
{
|
||||||
timeout: fixture.timeout ?? 60_000
|
timeout: fixture.timeout ?? 60_000
|
||||||
|
|
|
@ -5,7 +5,7 @@ export type E2ETestFixture = {
|
||||||
timeout?: number
|
timeout?: number
|
||||||
|
|
||||||
/** @default false */
|
/** @default false */
|
||||||
// only?: boolean
|
only?: boolean
|
||||||
|
|
||||||
request?: {
|
request?: {
|
||||||
/** @default 'GET' */
|
/** @default 'GET' */
|
||||||
|
@ -34,7 +34,7 @@ export type E2ETestFixtureSuite = {
|
||||||
fixtures: E2ETestFixture[]
|
fixtures: E2ETestFixture[]
|
||||||
|
|
||||||
/** @default false */
|
/** @default false */
|
||||||
// only?: boolean
|
only?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const fixtureSuites: E2ETestFixtureSuite[] = [
|
export const fixtureSuites: E2ETestFixtureSuite[] = [
|
||||||
|
|
|
@ -43,6 +43,7 @@ app.use(init)
|
||||||
|
|
||||||
// Wrangler does this for us. TODO: Does this happen on prod?
|
// Wrangler does this for us. TODO: Does this happen on prod?
|
||||||
// app.use(accessLogger)
|
// app.use(accessLogger)
|
||||||
|
|
||||||
app.use(responseTime)
|
app.use(responseTime)
|
||||||
|
|
||||||
app.all(async (ctx) => {
|
app.all(async (ctx) => {
|
||||||
|
|
Ładowanie…
Reference in New Issue