mirror of
https://github.com/morluto/rea.git
synced 2026-10-26 17:35:11 +00:00
Own operation results and exact rejections in withVerifierCleanup, including undefined, null and independent cleanup failures. Remove the optional-primary cleanup contract and migrate every caller, preserving returns, annotations, signal restoration and dependent cleanup order. Make Frida/JEB reporters fail on reasonless rejections and retain JEB fixture files while provider cleanup is incomplete. Own the nested packaged WASM verifier and expose its composite process/root cleanup capability for retry. Update runnable docs and isolated fixture dependencies. Validation: 547 focused cases in 20 files, eight isolated boundary unit checks, static/build/docs/discovery gates and duplication check (3.58%). Node process, SDK and descriptor cleanup are exercised; provider and packaging results in orchestration tests are simulated. Pack/install subprocess ownership remains with the existing shared package runner outside the nested-command change.
67 lines
2.3 KiB
JavaScript
67 lines
2.3 KiB
JavaScript
#!/usr/bin/env node
|
|
import assert from "node:assert/strict";
|
|
import { mkdtemp, readFile, rm } from "node:fs/promises";
|
|
import { tmpdir } from "node:os";
|
|
import { join } from "node:path";
|
|
import { chromium } from "playwright-core";
|
|
import { startBrowserVerifierSite } from "./fixtures/browser-verifier-site.mjs";
|
|
import { verifyBrowserDomDestinations } from "./lib/browser-dom-destinations-e2e.mjs";
|
|
import { withVerifierCleanup } from "./lib/verifier-cleanup.mjs";
|
|
import { requireOrdinaryWindowsVerifierCaller } from "./lib/windows-ordinary-user-verifier.mjs";
|
|
|
|
const executable = process.env.REA_BROWSER_EXECUTABLE;
|
|
if (!executable)
|
|
throw new Error("verify:browser:dom requires REA_BROWSER_EXECUTABLE");
|
|
await requireOrdinaryWindowsVerifierCaller();
|
|
let profile;
|
|
let site;
|
|
let context;
|
|
let report;
|
|
await withVerifierCleanup(async () => {
|
|
profile = await mkdtemp(join(tmpdir(), "rea-browser-dom-"));
|
|
site = await startBrowserVerifierSite();
|
|
context = await chromium.launchPersistentContext(profile, {
|
|
executablePath: executable,
|
|
headless: true,
|
|
args: ["--remote-debugging-port=0"],
|
|
});
|
|
const page = context.pages()[0] ?? (await context.newPage());
|
|
await page.goto(`${site.origin}/app?selected=fixture#section`);
|
|
const native = await page.evaluate(() =>
|
|
[
|
|
...document.querySelectorAll("form,button[formaction],input[formaction]"),
|
|
].map((element) =>
|
|
element.tagName === "FORM" ? element.action : element.formAction,
|
|
),
|
|
);
|
|
assert.deepEqual(native, Array(4).fill(page.url()));
|
|
const session = await context.newCDPSession(page);
|
|
const { targetInfo } = await session.send("Target.getTargetInfo");
|
|
await session.detach();
|
|
const [port] = (
|
|
await readFile(join(profile, "DevToolsActivePort"), "utf8")
|
|
).split("\n");
|
|
const result = await verifyBrowserDomDestinations(
|
|
{
|
|
cdp_endpoint: `http://127.0.0.1:${port}`,
|
|
target_id: targetInfo.targetId,
|
|
},
|
|
process.argv[2],
|
|
page.url(),
|
|
);
|
|
report = {
|
|
...result,
|
|
browser: context.browser().version(),
|
|
native_oracle: true,
|
|
verified: true,
|
|
};
|
|
}, [
|
|
() => context?.close(),
|
|
() => site?.close(),
|
|
async () => {
|
|
if (profile !== undefined)
|
|
await rm(profile, { recursive: true, force: true });
|
|
},
|
|
]);
|
|
process.stdout.write(`${JSON.stringify(report)}\n`);
|