Repository navigation
test(reader): fix the flaky golden pack check in gather.test.ts - #56
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
packLessongives JSZip no fixed date, so the test's two packs differ when they straddle a tick.Fix (test only): fake
Date(onlyDate; the test'ssetTimeouts 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.chalkfiles reproducible, but it changes the bytes the packer writes, so it is not in this PR.🤖 Generated with Claude Code