Repository navigation
Conversation
Add `npm run test:release`, which builds imagediff.js and imagediff.min.js fresh from the files npm would publish and runs the Node, CLI and browser specs against each. With --committed it also checks that the committed build outputs match the fresh build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
hsd review round 1 Verdict: approve. This does what #113 asks. Checked in the dev container (
Against the issue:
Nits (not blocking):
|
|
hsd: ready for human review after 1 review round(s). Agent sessions are still live in |
| // Smoke-tests the release files before publishing (npm run test:release). | ||
| // | ||
| // Copies the files npm would publish into .release/, builds imagediff.js and | ||
| // imagediff.min.js there, and runs the specs against each build the way users | ||
| // load it: through `require` in Node, as a <script> global in Chromium, and | ||
| // through the imagediff CLI. With --committed (on a release PR), it also | ||
| // checks that the committed build outputs match the fresh build. |
There was a problem hiding this comment.
If we just test the built files before committing, could all of this be an argument to npm run test which points to different sources?
There was a problem hiding this comment.
hsd: Yes. That's simpler, so I've changed it in 6c4f906:
make/release-check.jsand the.release/staging are gone.npm testtakesIMAGEDIFF_LIBRARY=<path from repo root>and runs the same Node and browser specs against that file instead ofjs/imagediff.js, e.g.IMAGEDIFF_LIBRARY=imagediff.min.js npm test. It's an env var rather than a CLI argument becausenpm test -- argonly reaches the last command intest:node && test:browser.npm run test:releaseis nownpm run build, thennpm testagainstimagediff.jsandimagediff.min.js, thengit diff --exit-codeon the two builds. That last step covers the issue's "committed outputs match a fresh build" requirement, and it replaces the--committedflag.
One thing doesn't change: bin/imagediff loads js/imagediff.js, so the CLI specs exercise the source whichever build is selected.
Replace make/release-check.js and its .release/ staging with one IMAGEDIFF_LIBRARY variable that runs the Node and browser specs against a built file. test:release builds, runs npm test against both builds, and fails if the build changed the committed outputs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
hsd review round 2 Verdict: approve. 6c4f906 makes the change @cesutherland asked for: the built file is now just a different target for Checked in the dev container (
Against the issue: one command ( Nits (not blocking):
|
|
hsd: ready for human review after 1 review round(s). Agent sessions are still live in |
|
Closing for a re-write of #113. |
Closes #113
Summary
npm testcan run against a built file:IMAGEDIFF_LIBRARY=<path from repo root>makes the Node specsrequirethat file (including the load specs: nocanvas, strict-mode wrapper) and makes the browser spec page load it as a plain<script>global. If it's unset, the specs usejs/imagediff.jsas before.npm run test:releaseis the one release command:npm run buildIMAGEDIFF_LIBRARY=imagediff.js npm testIMAGEDIFF_LIBRARY=imagediff.min.js npm test. Running the same suite against both files is how "the minified file behaves the same" is checked.git diff --exit-code -- imagediff.js imagediff.min.js, which fails if the fresh build differs from the committed build outputs.npm run test:releaseon the release PR before publishing.Decisions
npm testargument (per review):npm test -- argonly reaches the last command intest:node && test:browser, so a single env var is the simplest way to retarget both.git diff:test:releaseis only meant for release PRs. On other branches it rebuilds the files in the working tree and fails at the diff step, which is the expected result there.bin/imagediffrequires../js/imagediff.js(since build: rebuild committed build outputs only at release #111), so the published CLI runs the source, not a built file.npm testalready runs the CLI specs, and they do so in bothtest:releaseruns, but they exercise the source whichever build is selected. I didn't change what the CLI loads.npm run test:release. I didn't edit chore(release): 2.0.0 #101 itself because it is outside this ticket.Testing (in the dev container)
npm run build,IMAGEDIFF_LIBRARY=imagediff.js npm testandIMAGEDIFF_LIBRARY=imagediff.min.js npm testeach pass: 44 Node specs and 39 browser specs.git diff --exit-code -- imagediff.js imagediff.min.jsis clean after the build: the committed outputs match. I ran this step on the host because git can't see this worktree's repository from inside the container.IMAGEDIFF_LIBRARY=nope.jsfails in both Node and the browser, so the variable really switches targets.npm testwith the variable unset still passes against the source.🤖 Generated with Claude Code