mirror of
https://github.com/morluto/rea.git
synced 2026-10-23 14:22:30 -05:00
Use one cleanup owner across browser, Frida and JEB verifiers. Attempt all independent cleanup tasks, retain primary failures, and emit successful reports only after cleanup. Remove the superseded browser helper and duplicate tests. Validation: cleanup aggregation and runtime fixture tests, build and static checks passed. No real Frida or JEB run.
57 lines
1.6 KiB
TypeScript
57 lines
1.6 KiB
TypeScript
import { expect, it } from "vitest";
|
|
import { closeVerifierResources } from "../../../scripts/lib/verifier-cleanup.mjs";
|
|
|
|
it("attempts every cleanup and reports failures when there is no primary error", async () => {
|
|
const attempted: string[] = [];
|
|
const tasks = [
|
|
async () => {
|
|
attempted.push("provider");
|
|
throw new Error("provider close failed");
|
|
},
|
|
async () => {
|
|
attempted.push("fixture");
|
|
},
|
|
];
|
|
|
|
let failure: unknown;
|
|
try {
|
|
await closeVerifierResources(tasks);
|
|
} catch (cause) {
|
|
failure = cause;
|
|
}
|
|
expect(failure).toBeInstanceOf(AggregateError);
|
|
expect(
|
|
(failure as AggregateError).errors.map((error) => error.message),
|
|
).toEqual(["provider close failed"]);
|
|
expect(attempted).toEqual(["provider", "fixture"]);
|
|
});
|
|
|
|
it("retains primary verification and independent cleanup failures", async () => {
|
|
const primary = new Error("analysis assertion failed");
|
|
const attempted: string[] = [];
|
|
const tasks = [
|
|
async () => {
|
|
attempted.push("provider");
|
|
throw new Error("provider close failed");
|
|
},
|
|
async () => {
|
|
attempted.push("fixture");
|
|
throw new Error("fixture removal failed");
|
|
},
|
|
];
|
|
|
|
let failure: unknown;
|
|
try {
|
|
await closeVerifierResources(tasks, primary);
|
|
} catch (cause) {
|
|
failure = cause;
|
|
}
|
|
expect(failure).toBeInstanceOf(AggregateError);
|
|
expect((failure as AggregateError).errors).toEqual([
|
|
primary,
|
|
expect.objectContaining({ message: "provider close failed" }),
|
|
expect.objectContaining({ message: "fixture removal failed" }),
|
|
]);
|
|
expect(attempted).toEqual(["provider", "fixture"]);
|
|
});
|