Skip to content

test(reader): fix the flaky golden pack check in gather.test.ts - #56

Merged
sawradip merged 1 commit into
mainfrom
fix/pack-fixed-date
Nov 3, 2026
Merged

sawradip merged 1 commit into
mainfrom
fix/pack-fixed-date

Conversation

@sawradip

@sawradip sawradip commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

gather.test.ts › packs the very same bytes as the one-by-one way… failed now and then: it failed the 0.1.5 release run and the first 0.1.6 release run (run).

Cause: a ZIP entry carries the time it was packed (DOS time, 2-second steps) and packLesson gives JSZip no fixed date, so the test's two packs differ when they straddle a tick.

Fix (test only): fake Date (only Date; the test's setTimeouts still run) at a fixed instant while the two packs are made. No package code changes.

Checked: the test passes 5/5 locally; reader typecheck and eslint clean.

Follow-up worth considering separately: packing with a fixed date (e.g. the lesson's updatedAt) would make .chalk files reproducible, but it changes the bytes the packer writes, so it is not in this PR.

🤖 Generated with Claude Code

A ZIP entry carries the time it was packed (to 2 seconds), and packLesson gives JSZip no fixed date, so two packs
made either side of a tick differ and the byte-for-byte check failed now and then (it failed the 0.1.5 and the
0.1.6 release runs). The test now fakes only Date while it packs; its timers still run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sawradip
sawradip merged commit 014b119 into main Nov 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant