ci: parallelize real-api e2e files
This commit is contained in:
+20
-4
@@ -19,6 +19,21 @@ try {
|
||||
// No .env — fine, the environment may already carry the variables.
|
||||
}
|
||||
|
||||
const DEFAULT_E2E_MAX_WORKERS = 4
|
||||
|
||||
function positiveIntFromEnv(name: string, fallback: number): number {
|
||||
const raw = process.env[name]
|
||||
if (raw === undefined || raw === '') return fallback
|
||||
|
||||
const value = Number(raw)
|
||||
if (!Number.isInteger(value) || value < 1) {
|
||||
throw new Error(`${name} must be a positive integer, got ${JSON.stringify(raw)}`)
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
const e2eMaxWorkers = positiveIntFromEnv('DSH_E2E_MAX_WORKERS', DEFAULT_E2E_MAX_WORKERS)
|
||||
|
||||
export default defineConfig({
|
||||
// Same resolution note as vitest.config.ts: bare workspace names resolve
|
||||
// through the root tsconfig paths map; the native option cannot do this.
|
||||
@@ -31,9 +46,10 @@ export default defineConfig({
|
||||
testTimeout: 120_000,
|
||||
hookTimeout: 30_000,
|
||||
retry: 2,
|
||||
// Run e2e files one at a time: the shared internal API key has a small
|
||||
// concurrency quota, and parallel files issue enough simultaneous requests
|
||||
// to trip it (manifesting as flaky rate-limit errors).
|
||||
fileParallelism: false,
|
||||
// Run files in a bounded pool: enough lower-level parallelism to keep CI
|
||||
// and local with-key runs moving, while leaving a resource knob for shared
|
||||
// API quotas (`DSH_E2E_MAX_WORKERS=1` restores serial execution).
|
||||
fileParallelism: e2eMaxWorkers > 1,
|
||||
maxWorkers: e2eMaxWorkers,
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user