Skip to content

Commit da9bf8c

Browse files
test(insertion-suppression): fixture reader loads dynamically — a tools-less tree skips, not dies
The static harvest.mjs import defeated the file's own slice-portability idiom: in trees carrying only the extension (upstream cnighswonger#272/cnighswonger#278/cnighswonger#281) the whole file failed at module load, so the real-pair check never reached the skip it was designed to hit. The reader now loads like replayTools — dynamically, inside the test — and the fixture branch requires it, so tools-less trees skip with COULD NOT VERIFY. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TcivCe2iLnKZxpB4qTXzEb
1 parent b785aaf commit da9bf8c

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

test/insertion-suppression.test.mjs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import {
3535
pinnedBlockHashes,
3636
findSuppressibleDuplicate,
3737
} from "../proxy/extensions/insertion-normalization.mjs";
38-
import { readPinnedFixture } from "../tools/harvest.mjs";
3938

4039
const __dirname = dirname(fileURLToPath(import.meta.url));
4140
const REPO = join(__dirname, "..");
@@ -321,11 +320,19 @@ test(
321320
// Fixture-fallback: capture present -> unchanged live-capture path;
322321
// capture absent -> pinned fixture if present; else skip. Both readers
323322
// yield the same [n, line] tuple shape, so the replay loop below is
324-
// identical either way.
323+
// identical either way. The fixture reader ships in the tools slice
324+
// (like replayTools below), so it loads dynamically — a tree without
325+
// tools/ skips instead of failing at module load.
326+
let readPinnedFixture;
327+
try {
328+
({ readPinnedFixture } = await import("../tools/harvest.mjs"));
329+
} catch {
330+
readPinnedFixture = null;
331+
}
325332
let source;
326333
if (existsSync(REAL_CAPTURE)) {
327334
source = null; // resolved below, once readCapture is loaded from tools/replay.mjs
328-
} else if (existsSync(PINNED_FIXTURE)) {
335+
} else if (existsSync(PINNED_FIXTURE) && readPinnedFixture) {
329336
source = readPinnedFixture(PINNED_FIXTURE);
330337
} else {
331338
t.skip(

0 commit comments

Comments
 (0)