diff --git a/extensions/oc-path/src/oc-path/tests/jsonl/resolve.test.ts b/extensions/oc-path/src/oc-path/tests/jsonl/resolve.test.ts index 4f16d7464792..7eaac01f4a6c 100644 --- a/extensions/oc-path/src/oc-path/tests/jsonl/resolve.test.ts +++ b/extensions/oc-path/src/oc-path/tests/jsonl/resolve.test.ts @@ -87,19 +87,19 @@ describe("resolveJsonlToUniversal — file-relative line metadata (regression)", it("resolves L2/event with line=2 (not 1)", () => { const { ast } = parseJsonl(log); const m = resolveOcPath(ast, parseOcPath("oc://session.jsonl/L2/event")); - expect(m).not.toBeNull(); - if (m !== null) { - expect(m.line).toBe(2); + if (m === null) { + throw new Error("expected L2/event match"); } + expect(m.line).toBe(2); }); it("resolves L4/event with line=4", () => { const { ast } = parseJsonl(log); const m = resolveOcPath(ast, parseOcPath("oc://session.jsonl/L4/event")); - expect(m).not.toBeNull(); - if (m !== null) { - expect(m.line).toBe(4); + if (m === null) { + throw new Error("expected L4/event match"); } + expect(m.line).toBe(4); }); it("findOcPaths over wildcard surfaces correct file-relative lines", () => { diff --git a/extensions/oc-path/src/oc-path/tests/scenarios/cross-cutting.test.ts b/extensions/oc-path/src/oc-path/tests/scenarios/cross-cutting.test.ts index f38caf354d78..071b9415d73f 100644 --- a/extensions/oc-path/src/oc-path/tests/scenarios/cross-cutting.test.ts +++ b/extensions/oc-path/src/oc-path/tests/scenarios/cross-cutting.test.ts @@ -126,7 +126,9 @@ describe("cross-cutting", () => { ]; for (const path of cases) { const m = resolveOcPath(ast, path); - expect(m, `failed for ${JSON.stringify(path)}`).not.toBeNull(); + if (m === null) { + throw new Error(`failed for ${JSON.stringify(path)}`); + } } }); }); diff --git a/extensions/oc-path/src/oc-path/tests/scenarios/jsonc-byte-fidelity.test.ts b/extensions/oc-path/src/oc-path/tests/scenarios/jsonc-byte-fidelity.test.ts index a8dc2645d85e..26abefe603e4 100644 --- a/extensions/oc-path/src/oc-path/tests/scenarios/jsonc-byte-fidelity.test.ts +++ b/extensions/oc-path/src/oc-path/tests/scenarios/jsonc-byte-fidelity.test.ts @@ -15,8 +15,10 @@ function rt(raw: string): string { */ function assertParseable(raw: string): JsoncValue { const result = parseJsonc(raw); - expect(result.ast.root).not.toBeNull(); - return result.ast.root as JsoncValue; + if (result.ast.root === null) { + throw new Error("expected parseable JSONC root"); + } + return result.ast.root; } /** diff --git a/extensions/oc-path/src/oc-path/tests/scenarios/oc-path-resolver-edges.test.ts b/extensions/oc-path/src/oc-path/tests/scenarios/oc-path-resolver-edges.test.ts index feb533d82c4c..38479dba91fd 100644 --- a/extensions/oc-path/src/oc-path/tests/scenarios/oc-path-resolver-edges.test.ts +++ b/extensions/oc-path/src/oc-path/tests/scenarios/oc-path-resolver-edges.test.ts @@ -87,8 +87,10 @@ describe("oc-path-resolver-edges", () => { section: "tools", item: "gh", }); - expect(m).not.toBeNull(); - if (m?.kind === "item") { + if (m === null) { + throw new Error("expected tools item match"); + } + if (m.kind === "item") { expect(m.node.kv?.value).toBe("GitHub CLI"); } });