scripts/build.mjs and its commit message state that a failed build does not touch dist/. That held when checked by
hand, and no test covered it, so a later change to the swap could break it unnoticed.
test/build.test.js runs a copy of the script in a temporary package with one source file and the dist/ of an
earlier build, and compares every file and directory of that package before and after. Two cases: a type error
(the first compiler run fails, TS2322) and "export =" (CommonJS compiles, the ES module run fails with TS1203, so
the staging directory already holds cjs/ and types/).
Checked in a scratch copy: with the cleanup of the staging directory removed both tests fail; with cjs/ and types/
swapped in before the ES module run the second one fails. npm test: 27 pass in 5.7 s.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>