mirror of
https://github.com/ranxianglei/billion-context.git
synced 2026-11-23 01:58:16 +08:00
fix(tests): normalize golden snapshots to LF before compare (Windows autocrlf)
CI run 36102348905: all 4 golden tests failed on windows-latest because GitHub Actions checkouts materialize committed-LF files as CRLF in the worktree; runtime-generated canonical text uses LF. Normalize disk content to LF so the gate is platform-deterministic while still catching any real content drift.
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
// Golden schema snapshots (#1304 item 2). Every tool schema bili or the pinned
|
||||
// kernel advertises on any wire has a committed byte-exact snapshot under
|
||||
// tests/golden/wire-contract/. Any schema change turns these red; regeneration
|
||||
// (node --import tsx scripts/update-wire-contract-goldens.ts) is only valid
|
||||
// with justification in the PR body — silent drift is what #1299 was.
|
||||
// kernel advertises on any wire has a committed snapshot under
|
||||
// tests/golden/wire-contract/. Comparison is byte-exact on canonical LF text:
|
||||
// disk content is normalized \r\n → \n first because Windows CI checkouts
|
||||
// apply autocrlf and materialize committed-LF goldens as CRLF in the worktree
|
||||
// (first-run failure on windows-latest, run 36102348905). Any schema change
|
||||
// turns these red; regeneration (node --import tsx
|
||||
// scripts/update-wire-contract-goldens.ts) is only valid with justification in
|
||||
// the PR body — silent drift is what #1299 was.
|
||||
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
@@ -20,8 +24,8 @@ test("wire-contract goldens: no orphaned snapshot files", () => {
|
||||
});
|
||||
|
||||
for (const spec of buildGoldens()) {
|
||||
test(`wire-contract goldens: ${spec.name} (${spec.layer}) matches committed snapshot byte-for-byte`, () => {
|
||||
const expected = fs.readFileSync(path.join(GOLDEN_DIR, spec.name), "utf8");
|
||||
test(`wire-contract goldens: ${spec.name} (${spec.layer}) matches committed snapshot`, () => {
|
||||
const expected = fs.readFileSync(path.join(GOLDEN_DIR, spec.name), "utf8").replace(/\r\n/g, "\n");
|
||||
const actual = canonicalize(spec.build());
|
||||
assert.equal(
|
||||
actual,
|
||||
|
||||
Reference in New Issue
Block a user