Skip to content

Commit 1484571

Browse files
wayfarer3130claude
andcommitted
fix: make npm test build first, and approve esbuild's install script
Two problems that a maintainer hits on a clean checkout. 1. `npm test` needed a build before it, and it did not say so. `tests/bundle.test.ts` imports the package root (`import esmLibrary from '..'`), which package.json resolves to `release/`. On a checkout where `release/` is absent, that one suite fails: Error: Cannot find module '..' imported from tests/bundle.test.ts The test workflow hid the problem, because it runs `npm run build` before `npm test`. A maintainer who runs `npm ci && npm test` sees the failure. A `pretest` script now builds first, so `npm test` is correct in any order. `npm ci && npm test` passes on a clean clone. 2. npm 11 blocked esbuild's postinstall, and every install printed a warning: npm warn install-scripts 1 package has install scripts not yet covered npm warn install-scripts esbuild@0.19.7 (postinstall: node install.js) esbuild still worked here, because @esbuild/win32-x64 and its siblings carry the binary, and the postinstall is a fallback. The warning is still noise on every install, and the fallback matters on a platform whose binary package npm does not select. `allowScripts` now approves that one package, pinned to the version that `overrides.tsup.esbuild` holds, so a change of the pin asks for the approval again. Verified in linux containers on node 20, 22 and 24, and on windows: `npm ci` then `npm test` gives 11 test files and 54 tests passed, no install warning, and release/cjs/lossless.cjs and release/cjs/lossless.cjs.map stay byte-identical to the files that cornerstonejs/codecs vendors. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent ab62b35 commit 1484571

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎package.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
},
3434
"scripts": {
3535
"test": "vitest run",
36+
"pretest": "npm run build",
3637
"build": "tsup",
3738
"lint": "eslint .",
3839
"prepublishOnly": "npm run build"
@@ -63,5 +64,8 @@
6364
"tsup": {
6465
"esbuild": "0.19.7"
6566
}
67+
},
68+
"allowScripts": {
69+
"esbuild@0.19.7": true
6670
}
6771
}

0 commit comments

Comments
 (0)