also looking at this
test: retain bounded browser launch evidence on failure
#70
18 files
+620
-23
| @@ -7,6 +7,7 @@ import { spawnWorkspaceFixture } from '../helpers/workspace-process' | ||
| 7 | 7 | test.skipIf(process.env.EXECUTION_BROWSER_QA !== 'true')('compiled execution panel uses real native routes and a genuine Worker', async () => { |
| 8 | 8 | const directory = await mkdtemp(join(tmpdir(), 'drone-incident-access-')) |
| 9 | 9 | let owned: ReturnType<typeof spawnWorkspaceFixture> | undefined |
| 10 | let passed = false | |
| 10 | 11 | try { |
| 11 | 12 | const config = join(directory, 'bunfig.toml'); await writeFile(config, 'preload=[]\n') |
| 12 | 13 | owned = spawnWorkspaceFixture([process.execPath, `--config=${config}`, '--no-env-file', `${import.meta.dir}/../fixtures/public-safety-access/execution-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') }) |
| @@ -16,10 +17,15 @@ test.skipIf(process.env.EXECUTION_BROWSER_QA !== 'true')('compiled execution pan | ||
| 16 | 17 | const [code, stdout, stderr] = await Promise.all([child.exited, new Response(child.stdout as ReadableStream).text(), new Response(child.stderr as ReadableStream).text()]) |
| 17 | 18 | expect(code, `${stdout}\n${stderr}`).toBe(0) |
| 18 | 19 | expect(stdout).toContain('PASS actual execution browser: native live-before-return') |
| 20 | passed = true | |
| 19 | 21 | } |
| 20 | 22 | finally { clearTimeout(timeout) } |
| 21 | 23 | } |
| 22 | finally { await owned?.stop(); await rm(directory, { recursive: true, force: true }) } | |
| 24 | finally { | |
| 25 | await owned?.stop() | |
| 26 | if (passed) await rm(directory, { recursive: true, force: true }) | |
| 27 | else console.log(JSON.stringify({ evidence: 'retained-private-browser-fixture', directory })) | |
| 28 | } | |
| 23 | 29 | }, 110000) |
| 24 | 30 | |
| 25 | 31 | test('execution browser fixture refuses an unguarded directory before database or application writes', async () => { |