Files
opencode-manager/e2e/cleanup-reporter.ts
T
Chris Scott 0b42f7de97 test(e2e): clean up run artifacts after the suite
- server.sh removes e2e/.tmp when the backend exits, forwarding SIGTERM so
  Playwright's graceful shutdown still applies
- a cleanup reporter removes playwright-report and test-results after a
  passing run; failed runs keep them for debugging and CI upload
2026-10-12 09:31:13 -04:00

25 lines
726 B
TypeScript

import { rm } from 'node:fs/promises'
import type { FullResult, Reporter } from '@playwright/test/reporter'
import { REPORT_DIR, TEST_RESULTS_DIR } from './env'
/** Removes the HTML report and test results after a passing run; failed runs keep them for debugging and CI upload. */
export default class CleanupPassedRunReporter implements Reporter {
private status: FullResult['status'] | undefined
onEnd(result: FullResult) {
this.status = result.status
}
async onExit() {
if (this.status !== 'passed') return
await Promise.all([
rm(REPORT_DIR, { recursive: true, force: true }),
rm(TEST_RESULTS_DIR, { recursive: true, force: true }),
])
}
printsToStdio() {
return false
}
}