fix(verify): report final success only after resource cleanup

This commit is contained in:
morluto
2026-10-09 04:12:49 +08:00
parent 3eb7dbdc16
commit ee043e2cbf
17 changed files with 277 additions and 195 deletions
+8 -3
View File
@@ -13,6 +13,7 @@ if (!executable)
const profile = await mkdtemp(join(tmpdir(), "rea-browser-dom-"));
const site = await startBrowserVerifierSite();
let context;
let report;
try {
context = await chromium.launchPersistentContext(profile, {
executablePath: executable,
@@ -43,11 +44,15 @@ try {
process.argv[2],
page.url(),
);
process.stdout.write(
`${JSON.stringify({ ...result, browser: context.browser().version(), native_oracle: true, verified: true })}\n`,
);
report = {
...result,
browser: context.browser().version(),
native_oracle: true,
verified: true,
};
} finally {
await context?.close();
await site.close();
await rm(profile, { recursive: true, force: true });
}
process.stdout.write(`${JSON.stringify(report)}\n`);