also looking at this
test: retain bounded browser launch evidence on failure
#70
18 files
+620
-23
| @@ -8,6 +8,7 @@ import { spawnWorkspaceFixture } from '../helpers/workspace-process' | ||
| 8 | 8 | test.skipIf(process.env.WORKSPACE_BROWSER_QA !== 'true')('actual rendered workspace with native credentials and routes', async () => { |
| 9 | 9 | const directory = await mkdtemp(join(tmpdir(), 'drone-incident-access-')) |
| 10 | 10 | let owned: ReturnType<typeof spawnWorkspaceFixture> | undefined |
| 11 | let passed = false | |
| 11 | 12 | try { |
| 12 | 13 | const config = join(directory, 'bunfig.toml'); await writeFile(config, 'preload=[]\n') |
| 13 | 14 | owned = spawnWorkspaceFixture([process.execPath, `--config=${config}`, '--no-env-file', `${import.meta.dir}/../fixtures/public-safety-access/workspace-browser.ts`], directory, { ...process.env, APP_ENV: 'test', APP_DEBUG: 'false', NODE_ENV: 'test', DB_CONNECTION: 'sqlite', DB_DATABASE_PATH: join(directory, 'access.sqlite'), STX_DIR: join(directory, 'stx') }) |
| @@ -17,12 +18,14 @@ test.skipIf(process.env.WORKSPACE_BROWSER_QA !== 'true')('actual rendered worksp | ||
| 17 | 18 | const [code, stdout, stderr] = await Promise.all([child.exited, new Response(child.stdout as ReadableStream).text(), new Response(child.stderr as ReadableStream).text()]) |
| 18 | 19 | expect(code, `${stdout}\n${stderr}`).toBe(0) |
| 19 | 20 | expect(stdout).toContain('PASS actual compiled workspace browser') |
| 21 | passed = true | |
| 20 | 22 | } |
| 21 | 23 | finally { clearTimeout(timeout) } |
| 22 | 24 | } |
| 23 | 25 | finally { |
| 24 | 26 | await owned?.stop() |
| 25 | await rm(directory, { recursive: true, force: true }) | |
| 27 | if (passed) await rm(directory, { recursive: true, force: true }) | |
| 28 | else console.log(JSON.stringify({ evidence: 'retained-private-browser-fixture', directory })) | |
| 26 | 29 | } |
| 27 | 30 | }, 110000) |
| 28 | 31 | |