Skip to content

Commit 71e91e0

Browse files
Sawtaytoesclaude
andcommitted
test(render): assert palette conformance once, not per pixel
The Impression case ran one expect() per pixel — 384k calls — which took ~6.5s against vitest's 5s timeout and had failed every CI run on master since 2026-07-25, skipping docker-deploy and stranding the fleet on a stale :latest. Collect the off-palette colours and assert the set is empty: ~8x faster (7354ms -> 904ms) and a dither regression now reports which colours leaked rather than the first bad pixel's index. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b9042b0 commit 71e91e0

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

packages/render/src/renderDeviceImage.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,21 @@ describe("renderDeviceImage", () => {
5959
expect(info.height).toBe(device.height)
6060

6161
const allowed = paletteKeys(device.palette)
62+
const offendingColours = new Set<string>()
6263
Array.from({
6364
length: info.width * info.height,
6465
}).forEach((_unused, pixelIndex) => {
6566
const byteOffset = pixelIndex * info.channels
6667
const key = `${data[byteOffset]},${data[byteOffset + 1]},${data[byteOffset + 2]}`
67-
expect(allowed.has(key)).toBe(true)
68+
if (!allowed.has(key)) {
69+
offendingColours.add(key)
70+
}
6871
})
72+
73+
// Collect, then assert once. One expect() per pixel is 384k calls on the
74+
// Impression, which took ~6.5 s on CI against a 5 s timeout — and the set
75+
// of off-palette colours localises a dither bug better than the first bad
76+
// pixel's index does.
77+
expect(Array.from(offendingColours)).toEqual([])
6978
})
7079
})

0 commit comments

Comments
 (0)