Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

test: consolidate failure guards and trim unused fixture APIs

morlutoffd9611308c9
diff --git a/src/application/investigation/EvidenceLedger.residualUnknown.test.ts b/src/application/investigation/EvidenceLedger.residualUnknown.test.ts
index a199f5626..67edd8a6f 100644
--- a/src/application/investigation/EvidenceLedger.residualUnknown.test.ts
+++ b/src/application/investigation/EvidenceLedger.residualUnknown.test.ts
@@ -154,8 +154,7 @@ describe("residual unknown dependency histories", () => {
input("Does detached state remain intact?"),
mutation("detached-unknown"),
);
- expect(created.ok).toBe(true);
- if (!created.ok) return;
+ if (!created.ok) throw created.error;
Reflect.set(created.value, "status", "resolved");
const listed = store.listUnknowns();
@@ -185,8 +184,7 @@ describe("residual unknown dependency histories", () => {
input(" Is branch live? "),
mutation("one"),
);
- expect(first.ok).toBe(true);
- if (!first.ok) return;
+ if (!first.ok) throw first.error;
expect(first.value.unknown_id).toMatch(/^unk_[a-f0-9]{64}$/u);
expect(first.value.revision).toBe(1);
expect(store.listUnknowns({ severity: "high" })).toHaveLength(1);
diff --git a/src/application/javascript/JavaScriptSemanticGraphBuilder.test.ts b/src/application/javascript/JavaScriptSemanticGraphBuilder.test.ts
index bef8a1c9e..03a8231dc 100644
--- a/src/application/javascript/JavaScriptSemanticGraphBuilder.test.ts
+++ b/src/application/javascript/JavaScriptSemanticGraphBuilder.test.ts
@@ -76,7 +76,6 @@ it("keeps dynamic calls explicit and returns complete deterministic results", ()
const seedNodeId = graph.relations.find(
({ relation }) => relation === "defines",
)?.source_node_id;
- expect(seedNodeId).toBeDefined();
if (seedNodeId === undefined) throw new Error("Expected a definition seed");
const first = queryJavaScriptSemanticGraph(graph, {
diff --git a/src/application/managed/ManagedReconstructionService.test.ts b/src/application/managed/ManagedReconstructionService.test.ts
index a66b5bd4a..889672ce1 100644
--- a/src/application/managed/ManagedReconstructionService.test.ts
+++ b/src/application/managed/ManagedReconstructionService.test.ts
@@ -151,8 +151,7 @@ describe("managed decompiler reconstruction import", () => {
it("wraps imported reconstruction in Evidence", () => {
const evidence = importManagedReconstructionEvidence(exampleInput());
- expect(evidence.ok).toBe(true);
- if (!evidence.ok) return;
+ if (!evidence.ok) throw evidence.error;
expect(evidence.value).toMatchObject({
operation: "import_managed_reconstruction",
provider: { id: "rea-dotnet-workflows" },
diff --git a/src/application/native/EnhancedNativeInvestigation.test.ts b/src/application/native/EnhancedNativeInvestigation.test.ts
index e8f5e7313..89756fcd2 100644
--- a/src/application/native/EnhancedNativeInvestigation.test.ts
+++ b/src/application/native/EnhancedNativeInvestigation.test.ts
@@ -220,8 +220,7 @@ describe("native UI action trace", () => {
const result = await tools.execute("trace_native_ui_action", {
action: "buildTapped:",
});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
const trace = nativeInvestigationTraceSchema.parse(result.value);
expect(trace.start).toBe("action");
expect(trace.nodes.map(({ id }) => id)).toContain("native:function:0x1000");
@@ -297,8 +296,7 @@ describe("bounded native UI tracing", () => {
{ action: "buildTapped:", max_depth: 3 },
);
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(
nativeInvestigationTraceSchema
.parse(result.value)
@@ -337,8 +335,7 @@ describe("native UI query outcomes", () => {
const result = await tools.execute("trace_native_ui_action", {
action: "button",
});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value).toMatchObject({ start: "action" });
});
@@ -385,8 +382,7 @@ describe("native UI query outcomes", () => {
const result = await tools.execute("trace_native_ui_action", {
action: "buildTapped:",
});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value).toMatchObject({
reason: "action_selector_matches_multiple_ui_connections",
nodes: [{ id: "action" }, { id: "second-action" }],
diff --git a/src/browser/PlaywrightBrowserScenarioProvider.test.ts b/src/browser/PlaywrightBrowserScenarioProvider.test.ts
index 3c9a9304f..f1b748017 100644
--- a/src/browser/PlaywrightBrowserScenarioProvider.test.ts
+++ b/src/browser/PlaywrightBrowserScenarioProvider.test.ts
@@ -212,8 +212,7 @@ describe("PlaywrightBrowserScenarioProvider", () => {
open: () => Promise.resolve(session),
});
const result = await provider.captureScenario(scenario({ actions: 129 }));
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.scenario.action_count).toBe(129);
expect(result.value.steps).toHaveLength(130);
expect(result.value.steps.at(-1)?.step_id).toBe("wait_128");
@@ -227,8 +226,7 @@ describe("PlaywrightBrowserScenarioProvider", () => {
const result = await provider.captureScenario(
scenario({ captures: ["screenshot", "dom"] }),
);
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.completeness).toMatchObject({
status: "truncated",
equality_eligible: false,
@@ -243,8 +241,7 @@ describe("PlaywrightBrowserScenarioProvider", () => {
open: () => Promise.resolve(session),
});
const result = await provider.captureScenario(scenario({ actions: 2 }));
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.steps.map(({ status }) => status)).toEqual([
"completed",
"failed",
@@ -266,8 +263,7 @@ describe("PlaywrightBrowserScenarioProvider", () => {
const result = await provider.captureScenario(
scenario({ mode: "connect" }),
);
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.browser).toMatchObject({
process_ownership: "external",
cleanup: "disconnected-external",
@@ -317,8 +313,7 @@ describe("PlaywrightBrowserScenarioProvider", () => {
const result = await provider.captureScenario(scenario(), {
signal: controller.signal,
});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.steps[1]?.status).toBe("cancelled");
expect(session.closeCalls).toBe(1);
});
diff --git a/src/domain/explicitSensitiveFailure.test.ts b/src/domain/explicitSensitiveFailure.test.ts
index 28d935b82..16dbea9ef 100644
--- a/src/domain/explicitSensitiveFailure.test.ts
+++ b/src/domain/explicitSensitiveFailure.test.ts
@@ -69,7 +69,6 @@ it("coarsens format issue pointers without creating replacement coordinates", ()
],
);
const result = redactExplicitFailure(error, ["private/~", "private"]);
- expect(result).toBeInstanceOf(AnalysisInputError);
if (!(result instanceof AnalysisInputError))
throw new Error("Input error required");
expect(result.issues[0]?.path).toEqual(["capture_path", "/metadata"]);
diff --git a/src/process/capture/ProcessHarness.test.ts b/src/process/capture/ProcessHarness.test.ts
index 0f647918c..83a16ffeb 100644
--- a/src/process/capture/ProcessHarness.test.ts
+++ b/src/process/capture/ProcessHarness.test.ts
@@ -320,7 +320,6 @@ it("retains observations and both causes when process cleanup is unverifiable",
if (!(cause instanceof ProcessCaptureError)) throw cause;
error = cause;
}
- expect(error).toBeDefined();
if (error === undefined) throw new Error("expected cleanup-incomplete error");
const projection = projectAnalysisError(error);
@@ -391,7 +390,6 @@ it("projects execution and cleanup failures when capture never completed", () =>
if (!(cause instanceof ProcessCaptureError)) throw cause;
error = cause;
}
- expect(error).toBeDefined();
if (error === undefined) throw new Error("expected cleanup-incomplete error");
expect(error.partialObservation).toBeUndefined();
@@ -425,7 +423,6 @@ it("retains completed observations when finalization fails after clean cleanup",
if (!(cause instanceof ProcessCaptureError)) throw cause;
error = cause;
}
- expect(error).toBeDefined();
if (error === undefined) throw new Error("expected capture failure");
expect(error).toMatchObject({
@@ -477,7 +474,6 @@ it("preserves cancellation while projecting observations and successful cleanup"
if (!(cause instanceof ProcessCaptureError)) throw cause;
error = cause;
}
- expect(error).toBeDefined();
if (error === undefined) throw new Error("expected cancellation");
expect(projectAnalysisError(error)).toMatchObject({
diff --git a/tests/boundary/filesystem/clientConfigurationDialects.test.ts b/tests/boundary/filesystem/clientConfigurationDialects.test.ts
index ea45ad59b..32db9c757 100644
--- a/tests/boundary/filesystem/clientConfigurationDialects.test.ts
+++ b/tests/boundary/filesystem/clientConfigurationDialects.test.ts
@@ -58,7 +58,6 @@ describe("additional client configuration dialects", () => {
const client = getClients(home).find(
(candidate) => candidate.name === name,
);
- expect(client).toBeDefined();
if (client === undefined) throw new Error(`missing ${name} client`);
await mkdir(client.markerPath ?? home, { recursive: true });
@@ -126,7 +125,6 @@ describe("additional client configuration dialects", () => {
it("preserves OpenCode JSONC comments and sibling registrations during update and removal", async () => {
const home = await createTestTempDirectory("rea-opencode-jsonc-");
const client = getClients(home).find(({ name }) => name === "opencode");
- expect(client).toBeDefined();
if (client === undefined) throw new Error("missing OpenCode client");
await mkdir(client.markerPath ?? home, { recursive: true });
const original = `{
@@ -177,7 +175,6 @@ describe("additional client configuration dialects", () => {
it("rejects malformed OpenCode JSONC without creating a backup or changing bytes", async () => {
const home = await createTestTempDirectory("rea-opencode-invalid-");
const client = getClients(home).find(({ name }) => name === "opencode");
- expect(client).toBeDefined();
if (client === undefined) throw new Error("missing OpenCode client");
await mkdir(client.markerPath ?? home, { recursive: true });
const invalid = '{ "mcp": { /* broken */ "rea": [ }';
diff --git a/tests/boundary/filesystem/javascriptApplicationWorkflows.test.ts b/tests/boundary/filesystem/javascriptApplicationWorkflows.test.ts
index c3f72a195..5276b510a 100644
--- a/tests/boundary/filesystem/javascriptApplicationWorkflows.test.ts
+++ b/tests/boundary/filesystem/javascriptApplicationWorkflows.test.ts
@@ -506,8 +506,7 @@ describe("JavaScript runtime reconciliation local paths", () => {
],
});
- expect(reconciled.ok).toBe(true);
- if (!reconciled.ok) return;
+ if (!reconciled.ok) throw reconciled.error;
const result = javascriptRuntimeReconciliationResultSchema.parse(
reconciled.value.normalized_result,
);
diff --git a/tests/boundary/filesystem/referenceSourceComputedRequire.test.ts b/tests/boundary/filesystem/referenceSourceComputedRequire.test.ts
index 267e263fb..8f6695f6b 100644
--- a/tests/boundary/filesystem/referenceSourceComputedRequire.test.ts
+++ b/tests/boundary/filesystem/referenceSourceComputedRequire.test.ts
@@ -56,8 +56,7 @@ it("distinguishes computed require member values from literal members in source
caller: "reference-require-members-test",
policy: { secretPatterns: [] },
});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
const graph = result.value;
expect(graph.parse_failures).toEqual([]);
expect(graph.relationships).toEqual([
diff --git a/tests/boundary/filesystem/referenceSourceDockerfileLanguage.test.ts b/tests/boundary/filesystem/referenceSourceDockerfileLanguage.test.ts
index 5742af64f..56fe1ff86 100644
--- a/tests/boundary/filesystem/referenceSourceDockerfileLanguage.test.ts
+++ b/tests/boundary/filesystem/referenceSourceDockerfileLanguage.test.ts
@@ -29,8 +29,7 @@ it("imports Dockerfile-prefixed TypeScript with ordinary source evidence and unc
caller: "dockerfile-language-test",
policy: { secretPatterns: [] },
});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
const graph = result.value;
expect(graph.parse_failures).toEqual([]);
expect(graph.relationships).toHaveLength(sourcePaths.length * 3);
@@ -88,8 +87,7 @@ it("retains parser failures and hashes for malformed Dockerfile-prefixed TypeScr
caller: "dockerfile-language-test",
policy: { secretPatterns: [] },
});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.relationships).toEqual([]);
expect(result.value.parse_failures).toEqual(
paths.map((path) => ({
diff --git a/tests/boundary/filesystem/referenceSourceDynamicImports.test.ts b/tests/boundary/filesystem/referenceSourceDynamicImports.test.ts
index dd5b85e37..e78a56f37 100644
--- a/tests/boundary/filesystem/referenceSourceDynamicImports.test.ts
+++ b/tests/boundary/filesystem/referenceSourceDynamicImports.test.ts
@@ -30,8 +30,7 @@ it("resolves dynamic source imports while retaining computed targets as unknown"
caller: "reference-dynamic-import-test",
policy: { secretPatterns: [] },
});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.parse_failures).toEqual([]);
expect(result.value.relationships).toHaveLength(5);
for (const [to, kind] of [
diff --git a/tests/boundary/filesystem/referenceSourceImport.test.ts b/tests/boundary/filesystem/referenceSourceImport.test.ts
index 7c4c60c0a..87caa9801 100644
--- a/tests/boundary/filesystem/referenceSourceImport.test.ts
+++ b/tests/boundary/filesystem/referenceSourceImport.test.ts
@@ -123,8 +123,7 @@ describe("reference source symlink import", () => {
const imported = await importTree(root);
- expect(imported.ok).toBe(true);
- if (!imported.ok) return;
+ if (!imported.ok) throw imported.error;
expect(imported.value.entries).toContainEqual(
expect.objectContaining({
kind: "symlink",
@@ -154,8 +153,7 @@ describe("reference source manifest inventory", () => {
]);
const result = await importTree(root);
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.manifests).toEqual([
"CMakeLists.txt",
"src/CMakeLists.txt",
@@ -210,8 +208,7 @@ describe("reference source import behavior", () => {
policy: { secretPatterns: [] },
});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
// The importer always reports one standing advisory about pathname races,
// so completeness is asserted per entry rather than globally.
const limited = result.value.entries.filter(
@@ -262,8 +259,7 @@ describe("reference source import behavior", () => {
),
);
const result = await importTree(root);
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.entries.map(({ path }) => path)).toEqual(paths);
const repeated = await importTree(root);
expect(repeated).toEqual(result);
@@ -351,8 +347,7 @@ describe("reference source path selection", () => {
try {
const root = await fixture(parent, "tree");
const result = await importTree(root, undefined, []);
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.entries).toContainEqual(
expect.objectContaining({
path: ".env",
@@ -382,8 +377,7 @@ describe("reference source rooted module specifiers", () => {
"export const value = 1;\n",
);
const result = await importTree(root);
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.relationships).toContainEqual({
from_path: "src/main.js",
to: "/outside/dep.js",
diff --git a/tests/boundary/filesystem/referenceSourceReader.test.ts b/tests/boundary/filesystem/referenceSourceReader.test.ts
index 2deed7d7b..42c3bf0b0 100644
--- a/tests/boundary/filesystem/referenceSourceReader.test.ts
+++ b/tests/boundary/filesystem/referenceSourceReader.test.ts
@@ -19,8 +19,7 @@ describe("readReferenceSource entries", () => {
const result = await readReferenceSource(root);
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.entries.map(({ path }) => path)).toEqual([
"a.js",
"nested",
@@ -53,8 +52,7 @@ describe("readReferenceSource entries", () => {
const result = await readReferenceSource(root);
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.entries).toEqual([
{
status: "read",
@@ -98,8 +96,7 @@ describe("readReferenceSource entries", () => {
const result = await readReferenceSource(root);
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.bytesRead).toBe(size);
expect(result.value.entries).toContainEqual(
expect.objectContaining({
@@ -120,8 +117,7 @@ describe("readReferenceSource entries", () => {
const result = await readReferenceSource(root);
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
const path = [...segments, "deep.txt"].join("/");
expect(result.value.entries).toContainEqual(
expect.objectContaining({ status: "read", kind: "file", path }),
@@ -145,8 +141,7 @@ describe("readReferenceSource failures and exclusions", () => {
},
});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(checked).toEqual(["ignored", "kept"]);
expect(result.value.entries.map(({ path }) => path)).toEqual(["kept"]);
});
diff --git a/tests/boundary/filesystem/referenceSourceRecovery.test.ts b/tests/boundary/filesystem/referenceSourceRecovery.test.ts
index 6cb250f5f..53585d865 100644
--- a/tests/boundary/filesystem/referenceSourceRecovery.test.ts
+++ b/tests/boundary/filesystem/referenceSourceRecovery.test.ts
@@ -44,8 +44,7 @@ it("preserves recovered diagnostics and file evidence through filesystem import"
caller: "reference-recovery-test",
policy: { secretPatterns: [] },
});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
const graph = result.value;
expect(historicalSourceGraphSchema.safeParse(graph).success).toBe(true);
expect(graph.entries.map(({ path }) => path)).toEqual([
diff --git a/tests/boundary/filesystem/referenceSourceTestFilenames.test.ts b/tests/boundary/filesystem/referenceSourceTestFilenames.test.ts
index 6a6ca8401..9bc174d9c 100644
--- a/tests/boundary/filesystem/referenceSourceTestFilenames.test.ts
+++ b/tests/boundary/filesystem/referenceSourceTestFilenames.test.ts
@@ -28,8 +28,7 @@ it("imports test-suffixed filenames with unchanged paths, hashes, and languages"
caller: "reference-test-filenames-test",
policy: { secretPatterns: [] },
});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.entries).toHaveLength(files.length);
for (const [path, content, classifications, language] of files) {
expect(result.value.entries).toContainEqual({
@@ -70,8 +69,7 @@ it("keeps parser failures and unknown dependencies visible for test filenames",
caller: "reference-test-parsing-test",
policy: { secretPatterns: [] },
});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.inventory_state).toBe("partial");
expect(result.value.relationships).toEqual([
{
diff --git a/tests/boundary/filesystem/referenceSourceTypeScriptExtensions.test.ts b/tests/boundary/filesystem/referenceSourceTypeScriptExtensions.test.ts
index d0b842c8e..c6ca51b16 100644
--- a/tests/boundary/filesystem/referenceSourceTypeScriptExtensions.test.ts
+++ b/tests/boundary/filesystem/referenceSourceTypeScriptExtensions.test.ts
@@ -36,8 +36,7 @@ it.each([
caller: "native-typescript-source",
policy: { secretPatterns: [] },
});
- expect(imported.ok).toBe(true);
- if (!imported.ok) return;
+ if (!imported.ok) throw imported.error;
expect(imported.value.relationships).toContainEqual({
from_path: from,
to: target,
@@ -62,8 +61,7 @@ it.each(["main.ts", "main.js"])(
caller: "native-typescript-source",
policy: { secretPatterns: [] },
});
- expect(imported.ok).toBe(true);
- if (!imported.ok) return;
+ if (!imported.ok) throw imported.error;
expect(imported.value.relationships).toContainEqual(
expect.objectContaining({
from_path: from,
@@ -85,8 +83,7 @@ it("does not substitute TypeScript sources for a JavaScript runtime import", asy
caller: "native-typescript-source",
policy: { secretPatterns: [] },
});
- expect(imported.ok).toBe(true);
- if (!imported.ok) return;
+ if (!imported.ok) throw imported.error;
expect(imported.value.relationships).toContainEqual(
expect.objectContaining({
from_path: "main.js",
diff --git a/tests/boundary/inspector/javascriptRuntimeObservation.test.ts b/tests/boundary/inspector/javascriptRuntimeObservation.test.ts
index ed43e6d1e..314a12682 100644
--- a/tests/boundary/inspector/javascriptRuntimeObservation.test.ts
+++ b/tests/boundary/inspector/javascriptRuntimeObservation.test.ts
@@ -43,8 +43,7 @@ describe("passive V8 Inspector provider", () => {
const listed = await new V8InspectorProvider().listTargets({
inspector_endpoint: fake.endpoint,
});
- expect(listed.ok).toBe(true);
- if (!listed.ok) return;
+ if (!listed.ok) throw listed.error;
expect(listed.value.targets).toHaveLength(206);
expect(listed.value.targets[0]?.target_id).toBe(fake.targetId);
} finally {
@@ -63,8 +62,7 @@ describe("passive V8 Inspector provider", () => {
const result = await new V8InspectorProvider().listTargets({
inspector_endpoint: fake.endpoint,
});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.targets).toHaveLength(2);
expect(
result.value.targets.map(({ location }) => location),
@@ -89,8 +87,7 @@ describe("passive V8 Inspector provider", () => {
const result = await new V8InspectorProvider().observe(
observeInput(fake.endpoint, fake.targetId, "node"),
);
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.scripts.items).toHaveLength(3);
expect(result.value.scripts.excluded.unsupported_location).toBe(0);
expect(result.value.execution_contexts).toEqual([
@@ -124,8 +121,7 @@ describe("passive V8 Inspector provider", () => {
const listed = await provider.listTargets({
inspector_endpoint: fake.endpoint,
});
- expect(listed.ok).toBe(true);
- if (!listed.ok) return;
+ if (!listed.ok) throw listed.error;
expect(listed.value.targets).toEqual([]);
const observed = await provider.observe(
@@ -182,8 +178,7 @@ describe("complete Inspector script hashes", () => {
const result = await new V8InspectorProvider().observe(
observeInput(fake.endpoint, fake.targetId, "node"),
);
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.scripts.items).toHaveLength(scriptHashes.length);
expect(
new Set(result.value.scripts.items.map(({ cdp_hash }) => cdp_hash)),
@@ -205,8 +200,7 @@ describe("undeclared V8 runtime role", () => {
const input = observeInput(fake.endpoint, fake.targetId, "node");
delete input.runtime_kind;
const result = await new V8InspectorProvider().observe(input);
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.target).toMatchObject({
protocol_type: "page",
runtime_kind: "unknown",
@@ -230,8 +224,7 @@ describe("passive V8 Inspector evidence", () => {
...observeInput(fake.endpoint, fake.targetId, "node"),
};
const result = await new V8InspectorProvider().observe(input);
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.scripts.items).toHaveLength(1);
expect(result.value.scripts.items[0]?.location).toMatchObject({
kind: "url",
@@ -259,8 +252,7 @@ describe("passive V8 Inspector evidence", () => {
observation_ms: 1_000,
};
const result = await new V8InspectorProvider().observe(input);
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.capture.truncated).toBe(false);
expect(result.value.capture.truncation_reasons).toEqual([]);
expect(result.value.capture.events_dropped).toBe(0);
@@ -323,8 +315,7 @@ describe("passive V8 Inspector evidence", () => {
static_layers: JAVASCRIPT_RUNTIME_RECONCILIATION_EXAMPLE.static_layers,
runtime_observations: [runtimeEvidence],
});
- expect(reconciled.ok).toBe(true);
- if (!reconciled.ok) return;
+ if (!reconciled.ok) throw reconciled.error;
const result = javascriptRuntimeReconciliationResultSchema.parse(
reconciled.value.normalized_result,
);
diff --git a/tests/boundary/inspector/javascriptRuntimeTargetLocations.test.ts b/tests/boundary/inspector/javascriptRuntimeTargetLocations.test.ts
index 8ca85e342..56013bcec 100644
--- a/tests/boundary/inspector/javascriptRuntimeTargetLocations.test.ts
+++ b/tests/boundary/inspector/javascriptRuntimeTargetLocations.test.ts
@@ -35,8 +35,7 @@ test("lists and observes a Windows target without inventing a decoded path", asy
const listed = await provider.listTargets({
inspector_endpoint: fake.endpoint,
});
- expect(listed.ok).toBe(true);
- if (!listed.ok) return;
+ if (!listed.ok) throw listed.error;
expect(listed.value.targets).toMatchObject([
{
target_id: fake.targetId,
@@ -66,8 +65,7 @@ test("lists and observes a Windows target without inventing a decoded path", asy
target_id: fake.targetId,
observation_ms: 10,
});
- expect(observed.ok).toBe(true);
- if (!observed.ok) return;
+ if (!observed.ok) throw observed.error;
expect(observed.value.target.location).toEqual(
listed.value.targets[0]?.location,
);
@@ -97,8 +95,7 @@ test
const listed = await new V8InspectorProvider().listTargets({
inspector_endpoint: fake.endpoint,
});
- expect(listed.ok).toBe(true);
- if (!listed.ok) return;
+ if (!listed.ok) throw listed.error;
expect(listed.value.targets).toMatchObject([
{ location: { kind: "file", file_path: entry } },
]);
@@ -116,8 +113,7 @@ test("keeps a lossy discovery name unresolved even when its underscore alias exi
const listed = await new V8InspectorProvider().listTargets({
inspector_endpoint: fake.endpoint,
});
- expect(listed.ok).toBe(true);
- if (!listed.ok) return;
+ if (!listed.ok) throw listed.error;
expect(listed.value.targets).toMatchObject([
{ location: { kind: "unresolved", reported_url: reported } },
]);
@@ -137,8 +133,7 @@ test.each([
const listed = await new V8InspectorProvider().listTargets({
inspector_endpoint: fake.endpoint,
});
- expect(listed.ok).toBe(true);
- if (!listed.ok) return;
+ if (!listed.ok) throw listed.error;
expect(listed.value.targets).toEqual([]);
expect(listed.value.excluded.unsupported_location).toBe(1);
} finally {
@@ -158,8 +153,7 @@ test.each([
const listed = await new V8InspectorProvider().listTargets({
inspector_endpoint: fake.endpoint,
});
- expect(listed.ok).toBe(true);
- if (!listed.ok) return;
+ if (!listed.ok) throw listed.error;
expect(listed.value.targets).toEqual([]);
expect(listed.value.excluded.unsupported_location).toBe(1);
} finally {
@@ -183,8 +177,7 @@ test("does not reinterpret lossy discovery paths in script metadata", async () =
target_id: fake.targetId,
observation_ms: 10,
});
- expect(observed.ok).toBe(true);
- if (!observed.ok) return;
+ if (!observed.ok) throw observed.error;
expect(observed.value.scripts.items).toMatchObject([
{ location: { kind: "file", file_path: entry } },
]);
diff --git a/tests/boundary/mcp/ghidraEvidenceMcp.test.ts b/tests/boundary/mcp/ghidraEvidenceMcp.test.ts
index ada117a6d..7506a7d0b 100644
--- a/tests/boundary/mcp/ghidraEvidenceMcp.test.ts
+++ b/tests/boundary/mcp/ghidraEvidenceMcp.test.ts
@@ -112,8 +112,7 @@ describe("Ghidra MCP evidence parity", () => {
"binary_overview",
{},
);
- expect(directOverview.ok).toBe(true);
- if (!directOverview.ok) return;
+ if (!directOverview.ok) throw directOverview.error;
expect(mcpOverview.normalized_result).toEqual(directOverview.value);
expect(mcpOverview).toMatchObject({
provider: { id: "rea-workflow" },
@@ -191,8 +190,7 @@ describe("Ghidra MCP evidence parity", () => {
"analyze_function",
{ procedure: "fixture_main" },
);
- expect(directAnalyzed.ok).toBe(true);
- if (!directAnalyzed.ok) return;
+ if (!directAnalyzed.ok) throw directAnalyzed.error;
expect(analyzed.normalized_result).toEqual(directAnalyzed.value);
} finally {
await harness.close();
diff --git a/tests/boundary/providers/ghidra/ghidraClient.test.ts b/tests/boundary/providers/ghidra/ghidraClient.test.ts
index 45dedebd0..a4dd31857 100644
--- a/tests/boundary/providers/ghidra/ghidraClient.test.ts
+++ b/tests/boundary/providers/ghidra/ghidraClient.test.ts
@@ -202,8 +202,7 @@ describe("GhidraClient", () => {
const client = clientFor(new FixtureLauncher("oversized_result"));
const result = await client.callTool("list_strings", { document: null });
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
if (!Array.isArray(result.value))
throw new TypeError("Ghidra fixture result was not an inventory array");
const first = result.value[0];
diff --git a/tests/boundary/providers/ghidra/ghidraLauncher.test.ts b/tests/boundary/providers/ghidra/ghidraLauncher.test.ts
index 591a554d3..01b84aee6 100644
--- a/tests/boundary/providers/ghidra/ghidraLauncher.test.ts
+++ b/tests/boundary/providers/ghidra/ghidraLauncher.test.ts
@@ -231,8 +231,7 @@ describe("Ghidra headless launcher", () => {
providerVersion: "12.1.4",
profileDigest: "a".repeat(64),
});
- expect(launched.ok).toBe(true);
- if (!launched.ok) return;
+ if (!launched.ok) throw launched.error;
const capturePath = join(runtimeRoot, "launch-capture.json");
await vi.waitFor(() => access(`${capturePath}.ready`), { timeout: 10_000 });
const capture = launchCaptureSchema.parse(
diff --git a/tests/boundary/providers/managed/managedMemberComparison.test.ts b/tests/boundary/providers/managed/managedMemberComparison.test.ts
index 1cb1c2f0e..2ba2eb13f 100644
--- a/tests/boundary/providers/managed/managedMemberComparison.test.ts
+++ b/tests/boundary/providers/managed/managedMemberComparison.test.ts
@@ -40,8 +40,7 @@ it.each([
await writeFile(leftPath, left);
await writeFile(rightPath, right);
const result = await compareManagedMemberPaths({ leftPath, rightPath });
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
const comparison = managedMemberComparisonResultSchema.parse(
result.value.normalized_result,
);
@@ -83,8 +82,7 @@ describe("managed member comparison path workflow", () => {
right: observe(0xfe, "/tmp/partial-right.dll"),
});
const result = compareManagedMembersEvidenceValidated(input);
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
const comparison = managedMemberComparisonResultSchema.parse(
result.value.normalized_result,
);
@@ -114,8 +112,7 @@ describe("managed member comparison path workflow", () => {
rightPath,
});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value).toMatchObject({
operation: "compare_managed_members",
confidence: "inferred",
diff --git a/tests/boundary/providers/managed/managedStaticProvider.test.ts b/tests/boundary/providers/managed/managedStaticProvider.test.ts
index 0f2466d04..00e92cda4 100644
--- a/tests/boundary/providers/managed/managedStaticProvider.test.ts
+++ b/tests/boundary/providers/managed/managedStaticProvider.test.ts
@@ -22,13 +22,11 @@ describe("managed static provider path boundary", () => {
const path = join(directory, "fixture.exe");
await writeFile(path, bytes);
const parsed = await parseBinaryTarget(path);
- expect(parsed.ok).toBe(true);
- if (!parsed.ok) return;
+ if (!parsed.ok) throw parsed.error;
const client = new ManagedStaticProvider().createClient(parsed.value);
const observed = await client.execute("inspect_managed_artifact", {});
- expect(observed.ok).toBe(true);
- if (!observed.ok) return;
+ if (!observed.ok) throw observed.error;
expect(asManagedResult(observed.value)).toMatchObject({
classification: { status: "managed", runtime_family: "modern-dotnet" },
artifact: { path, sha256: parsed.value.sha256, format: "pe" },
@@ -37,8 +35,7 @@ describe("managed static provider path boundary", () => {
expect(observed.value.subject).toMatchObject({ path, format: "pe" });
const members = await client.execute("inspect_managed_members", {});
- expect(members.ok).toBe(true);
- if (!members.ok) return;
+ if (!members.ok) throw members.error;
expect(asManagedMemberResult(members.value)).toMatchObject({
artifact: { path, sha256: parsed.value.sha256, format: "pe" },
methods: [expect.objectContaining({ token: "0x06000001" })],
@@ -60,8 +57,7 @@ describe("managed static provider path boundary", () => {
"inspect_managed_native_boundaries",
{},
);
- expect(boundaries.ok).toBe(true);
- if (!boundaries.ok) return;
+ if (!boundaries.ok) throw boundaries.error;
const boundaryResult = asManagedNativeBoundaryResult(boundaries.value);
expect(boundaryResult).toMatchObject({
artifact: { path, sha256: parsed.value.sha256, format: "pe" },
@@ -116,16 +112,14 @@ describe("managed static provider path boundary", () => {
const path = join(directory, "fixture.exe");
await writeFile(path, bytes);
const parsed = await parseBinaryTarget(path);
- expect(parsed.ok).toBe(true);
- if (!parsed.ok) return;
+ if (!parsed.ok) throw parsed.error;
const client = new ManagedStaticProvider().createClient(parsed.value);
const execution = await client.execute(
"inspect_managed_native_boundaries",
{},
);
- expect(execution.ok).toBe(true);
- if (!execution.ok) return;
+ if (!execution.ok) throw execution.error;
const result = asManagedNativeBoundaryResult(execution.value);
expect(result.pinvoke_imports.length).toBeGreaterThan(0);
expect(execution.value.locations).toEqual(
@@ -162,19 +156,16 @@ it("retains U+FEFF metadata through the filesystem target and provider", async (
}),
);
const parsed = await parseBinaryTarget(path);
- expect(parsed.ok).toBe(true);
- if (!parsed.ok) return;
+ if (!parsed.ok) throw parsed.error;
const client = new ManagedStaticProvider().createClient(parsed.value);
const artifact = await client.execute("inspect_managed_artifact", {});
- expect(artifact.ok).toBe(true);
- if (!artifact.ok) return;
+ if (!artifact.ok) throw artifact.error;
expect(asManagedResult(artifact.value)).toMatchObject({
references: [expect.objectContaining({ name: "\uFEFFSystem.Runtime" })],
target_frameworks: ["\uFEFF.NETCoreApp,Version=v8.0"],
});
const members = await client.execute("inspect_managed_members", {});
- expect(members.ok).toBe(true);
- if (!members.ok) return;
+ if (!members.ok) throw members.error;
expect(asManagedMemberResult(members.value)).toMatchObject({
types: [expect.objectContaining({ name: "\uFEFFProgram" })],
methods: [expect.objectContaining({ name: "\uFEFFMain" })],
@@ -188,26 +179,22 @@ it("keeps non-CIL implementation bytes unknown through the real file provider",
const bytes = buildManagedPeFixture();
await writeFile(path, bytes);
const originalTarget = await parseBinaryTarget(path);
- expect(originalTarget.ok).toBe(true);
- if (!originalTarget.ok) return;
+ if (!originalTarget.ok) throw originalTarget.error;
const original = await new ManagedStaticProvider()
.createClient(originalTarget.value)
.execute("inspect_managed_members", {});
- expect(original.ok).toBe(true);
- if (!original.ok) return;
+ if (!original.ok) throw original.error;
const row = asManagedMemberResult(original.value).methods[0]?.row_offset;
expect(row).toBeDefined();
if (row === undefined) return;
bytes.writeUInt16LE(1, row + 4);
await writeFile(path, bytes);
const nativeTarget = await parseBinaryTarget(path);
- expect(nativeTarget.ok).toBe(true);
- if (!nativeTarget.ok) return;
+ if (!nativeTarget.ok) throw nativeTarget.error;
const native = await new ManagedStaticProvider()
.createClient(nativeTarget.value)
.execute("inspect_managed_members", {});
- expect(native.ok).toBe(true);
- if (!native.ok) return;
+ if (!native.ok) throw native.error;
const result = asManagedMemberResult(native.value);
expect(result.methods[0]?.body).toMatchObject({
status: "partial",
@@ -220,13 +207,11 @@ it("keeps non-CIL implementation bytes unknown through the real file provider",
bytes.writeUInt32LE(0, row);
await writeFile(path, bytes);
const absentTarget = await parseBinaryTarget(path);
- expect(absentTarget.ok).toBe(true);
- if (!absentTarget.ok) return;
+ if (!absentTarget.ok) throw absentTarget.error;
const absent = await new ManagedStaticProvider()
.createClient(absentTarget.value)
.execute("inspect_managed_members", {});
- expect(absent.ok).toBe(true);
- if (!absent.ok) return;
+ if (!absent.ok) throw absent.error;
expect(asManagedMemberResult(absent.value).methods[0]?.body.status).toBe(
"absent",
);
diff --git a/tests/boundary/providers/native/artifactProvider.directoryErrors.test.ts b/tests/boundary/providers/native/artifactProvider.directoryErrors.test.ts
index 25264cfa1..8a05befd9 100644
--- a/tests/boundary/providers/native/artifactProvider.directoryErrors.test.ts
+++ b/tests/boundary/providers/native/artifactProvider.directoryErrors.test.ts
@@ -30,8 +30,7 @@ describe("artifact directory diagnostics", () => {
await chmod(blockedPath, 0);
try {
const target = await parseBinaryTarget(appPath);
- expect(target.ok).toBe(true);
- if (!target.ok) return;
+ if (!target.ok) throw target.error;
const result = await new ArtifactProvider()
.createClient(target.value)
.execute("inventory_artifact", {});
diff --git a/tests/boundary/providers/native/artifactProvider.extraction.test.ts b/tests/boundary/providers/native/artifactProvider.extraction.test.ts
index a532d35fc..534ff59d1 100644
--- a/tests/boundary/providers/native/artifactProvider.extraction.test.ts
+++ b/tests/boundary/providers/native/artifactProvider.extraction.test.ts
@@ -81,8 +81,7 @@ describe("artifact extraction", () => {
output_root: output,
}),
);
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
const firstExtraction = artifactExtractionResultSchema.parse(
result.value.result,
);
@@ -110,8 +109,7 @@ describe("artifact extraction", () => {
output_root: relocatedOutput,
}),
);
- expect(relocated.ok).toBe(true);
- if (!relocated.ok) return;
+ if (!relocated.ok) throw relocated.error;
expect(
artifactExtractionResultSchema.parse(relocated.value.result)
.extraction_manifest,
diff --git a/tests/boundary/providers/native/nativeInventory.golden.test.ts b/tests/boundary/providers/native/nativeInventory.golden.test.ts
index d931c6d5d..ba1cc8d45 100644
--- a/tests/boundary/providers/native/nativeInventory.golden.test.ts
+++ b/tests/boundary/providers/native/nativeInventory.golden.test.ts
@@ -148,8 +148,7 @@ it("retains native inventory facts from captured Apple tool output", async () =>
"darwin",
).createClient(machoTarget("/private/fixture"));
const execution = await client.execute("inspect_macho", {});
- expect(execution.ok).toBe(true);
- if (!execution.ok) return;
+ if (!execution.ok) throw execution.error;
expect(execution.value.result).toMatchObject({
imports: {
items: [
diff --git a/tests/boundary/providers/native/nativeLoadKinds.golden.test.ts b/tests/boundary/providers/native/nativeLoadKinds.golden.test.ts
index b25cb3de0..545e131c7 100644
--- a/tests/boundary/providers/native/nativeLoadKinds.golden.test.ts
+++ b/tests/boundary/providers/native/nativeLoadKinds.golden.test.ts
@@ -99,8 +99,7 @@ it("limits thread-state entrypoints instead of reporting none silently", async (
nativeMachoTarget("/owned/legacy-fixture"),
);
const result = await client.execute("inspect_macho", {});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.result).toMatchObject({
entrypoints: {
items: [],
diff --git a/tests/boundary/providers/native/nativeMachoHeader.golden.test.ts b/tests/boundary/providers/native/nativeMachoHeader.golden.test.ts
index cca46e321..1f1c3e72c 100644
--- a/tests/boundary/providers/native/nativeMachoHeader.golden.test.ts
+++ b/tests/boundary/providers/native/nativeMachoHeader.golden.test.ts
@@ -20,8 +20,7 @@ it("collects the actual Mach header alongside the native load commands", async (
nativeMachoTarget("/owned/fixture"),
);
const result = await client.execute("inspect_macho", {});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.result).toMatchObject({
file_type: "2",
flags: ["0x00200085"],
diff --git a/tests/boundary/providers/native/nativeProvider.test.ts b/tests/boundary/providers/native/nativeProvider.test.ts
index 9bed9342f..e0dca4d21 100644
--- a/tests/boundary/providers/native/nativeProvider.test.ts
+++ b/tests/boundary/providers/native/nativeProvider.test.ts
@@ -127,8 +127,7 @@ describe("native macOS provider inspection", () => {
machoTarget("/private/fixture"),
);
const execution = await client.execute("inspect_macho", {});
- expect(execution.ok).toBe(true);
- if (!execution.ok) return;
+ if (!execution.ok) throw execution.error;
expect(execution.value.provider.id).toBe("native-macos");
expect(execution.value.result).toMatchObject({
format: "mach-o",
@@ -170,8 +169,7 @@ describe("native macOS provider inspection", () => {
const execution = await client.execute("inspect_macho", {});
- expect(execution.ok).toBe(true);
- if (!execution.ok) return;
+ if (!execution.ok) throw execution.error;
expect(execution.value.result).toMatchObject({
segments: {
items: [
@@ -204,8 +202,7 @@ describe("native macOS provider inspection", () => {
const execution = await client.execute("inspect_macho", {});
- expect(execution.ok).toBe(true);
- if (!execution.ok) return;
+ if (!execution.ok) throw execution.error;
expect(execution.value.limitations).toEqual(
expect.arrayContaining([expect.stringMatching(/vtool.*unavailable/iu)]),
);
@@ -329,8 +326,7 @@ describe("native signature entitlements", () => {
const signature = await client.execute("inspect_signature", {});
- expect(signature.ok).toBe(true);
- if (!signature.ok) return;
+ if (!signature.ok) throw signature.error;
expect(signature.value.result).toMatchObject({
entitlements: { "com.apple.security.app-sandbox": true },
});
diff --git a/tests/boundary/providers/native/nativeReexport.golden.test.ts b/tests/boundary/providers/native/nativeReexport.golden.test.ts
index db9fcab88..163a42175 100644
--- a/tests/boundary/providers/native/nativeReexport.golden.test.ts
+++ b/tests/boundary/providers/native/nativeReexport.golden.test.ts
@@ -15,8 +15,7 @@ it("retains native re-export dependencies alongside ordinary and identity comman
nativeMachoTarget("/owned/libOuter.dylib"),
);
const result = await client.execute("inspect_macho", {});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.result).toMatchObject({
dependencies: {
exhaustive: true,
diff --git a/tests/boundary/providers/native/nativeSelectedArchitecture.test.ts b/tests/boundary/providers/native/nativeSelectedArchitecture.test.ts
index 7d35ca01c..c796fe41b 100644
--- a/tests/boundary/providers/native/nativeSelectedArchitecture.test.ts
+++ b/tests/boundary/providers/native/nativeSelectedArchitecture.test.ts
@@ -28,8 +28,7 @@ it("does not attribute the first universal slice's UUID and segments to the sele
"darwin",
).createClient(nativeMachoTarget("/owned/universal"));
const result = await client.execute("inspect_macho", {});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.result).toMatchObject({
uuid: "01234567-89AB-CDEF-0123-456789ABCDEF",
architectures: { total: 2 },
@@ -96,8 +95,7 @@ it.each([
const result = await client.execute("inspect_macho", {});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(result.value.result).toMatchObject({
uuid: "01234567-89AB-CDEF-0123-456789ABCDEF",
architectures: {
diff --git a/tests/composition/analysis-sessions/appleApplication.test.ts b/tests/composition/analysis-sessions/appleApplication.test.ts
index d944e4f16..5506ff09d 100644
--- a/tests/composition/analysis-sessions/appleApplication.test.ts
+++ b/tests/composition/analysis-sessions/appleApplication.test.ts
@@ -293,8 +293,7 @@ describe("Apple application projection completeness", () => {
const result = projectAppleApplicationEvidence({
inventory_evidence: [inventory],
});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
expect(
appleApplicationProjectionResultSchema.parse(
result.value.normalized_result,
diff --git a/tests/composition/analysis-sessions/binarySession.test.ts b/tests/composition/analysis-sessions/binarySession.test.ts
index 4f8f338b5..ec066fa92 100644
--- a/tests/composition/analysis-sessions/binarySession.test.ts
+++ b/tests/composition/analysis-sessions/binarySession.test.ts
@@ -552,8 +552,7 @@ describe("replay of exact immutable calls", () => {
).ok,
).toBe(true);
const snapshot = initial.exportAnalysisSnapshot();
- expect(snapshot.ok).toBe(true);
- if (!snapshot.ok) return;
+ if (!snapshot.ok) throw snapshot.error;
expect(snapshot.value.entries).toHaveLength(1);
await initial.close();
diff --git a/tests/composition/android/application.test.ts b/tests/composition/android/application.test.ts
index ad7ff2b94..0ce74967e 100644
--- a/tests/composition/android/application.test.ts
+++ b/tests/composition/android/application.test.ts
@@ -163,8 +163,7 @@ describe("Android application projection", () => {
inventory_evidence: [inventory],
});
- expect(result.ok).toBe(true);
- if (!result.ok) return;
+ if (!result.ok) throw result.error;
const projection = androidApplicationProjectionResultSchema.parse(
result.value.normalized_result,
);
diff --git a/tests/conformance/providers/managed/managedNativeVerification.test.ts b/tests/conformance/providers/managed/managedNativeVerification.test.ts
index 67b547c5e..4932ae110 100644
--- a/tests/conformance/providers/managed/managedNativeVerification.test.ts
+++ b/tests/conformance/providers/managed/managedNativeVerification.test.ts
@@ -205,8 +205,7 @@ describe("managed/native boundary verification", () => {
it("wraps verification in derived workflow Evidence", () => {
const evidence = verifyManagedNativeBoundariesEvidence(exampleInput());
- expect(evidence.ok).toBe(true);
- if (!evidence.ok) return;
+ if (!evidence.ok) throw evidence.error;
expect(evidence.value).toMatchObject({
operation: "verify_managed_native_boundaries",
provider: { id: "rea-dotnet-workflows" },
diff --git a/tests/support/applicationSessionFixture.ts b/tests/support/applicationSessionFixture.ts
index 20440ae55..b7f58b0b0 100644
--- a/tests/support/applicationSessionFixture.ts
+++ b/tests/support/applicationSessionFixture.ts
@@ -2,7 +2,6 @@ import { writeFile } from "node:fs/promises";
import { join } from "node:path";
import { TextReader, Uint8ArrayWriter, ZipWriter } from "@zip.js/zip.js";
-import { expect } from "vitest";
import { runProviderAnalysis } from "../../src/composition/directAnalysis.js";
import type { AnalysisError } from "../../src/domain/analysisErrorBase.js";
@@ -14,7 +13,6 @@ import { createTestTempDirectory } from "../fixtures/temporaryDirectory.js";
export const requireSuccessfulProjection = (
result: Result<Evidence, AnalysisError>,
): Evidence => {
- expect(result.ok).toBe(true);
if (!result.ok)
throw new TypeError("Expected application projection to succeed");
return result.value;
diff --git a/tests/support/workspace/workspaceFixture.ts b/tests/support/workspace/workspaceFixture.ts
index db8bb551a..e59929951 100644
--- a/tests/support/workspace/workspaceFixture.ts
+++ b/tests/support/workspace/workspaceFixture.ts
@@ -1,11 +1,4 @@
-import {
- mkdir,
- mkdtemp,
- readFile,
- realpath,
- rm,
- writeFile,
-} from "node:fs/promises";
+import { mkdir, mkdtemp, realpath, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
@@ -13,12 +6,9 @@ import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
export interface TestWorkspace {
readonly root: string;
readonly home: string;
- readonly xdgConfigHome: string;
- readonly xdgCacheHome: string;
readonly environment: NodeJS.ProcessEnv;
path(...segments: readonly string[]): string;
mkdir(relativePath: string): Promise<string>;
- read(relativePath: string): Promise<string>;
write(relativePath: string, contents: string | Uint8Array): Promise<string>;
}
@@ -64,8 +54,6 @@ export const createTestWorkspace = async (
return {
root,
home,
- xdgConfigHome,
- xdgCacheHome,
environment: {
HOME: home,
XDG_CONFIG_HOME: xdgConfigHome,
@@ -77,7 +65,6 @@ export const createTestWorkspace = async (
await mkdir(path, { recursive: true });
return path;
},
- read: (relativePath) => readFile(resolvePath(relativePath), "utf8"),
write: async (relativePath, contents) => {
const path = resolvePath(relativePath);
await mkdir(dirname(path), { recursive: true });