fix: build before running tests via pretest (broken publish gate) - #149
Merged
Conversation
Same root cause as esse#421/utils#53's prepublishOnly fixes, but surfaced differently: js/publish's "Verify tests" step (npm test) runs before "Publish release to NPM" (where prepublishOnly would fire), and standata's own test suite requires its own freshly-built dist/js/runtime_data/*.json (a self-referencing import chain through @mat3ra/mode, which imports back from @mat3ra/standata/dist/js/...). Without a build first, `npm test` failed on `Cannot find module '@mat3ra/standata/dist/js/runtime_data/models/ modelsTreeConfigByApplication.json'`, which blocked #148's post-merge publish entirely (no broken package shipped this time - the failure was in the test gate, before publish). Add pretest (npm's test lifecycle hook, unlike prepublishOnly which only fires for publish/pack) running the same build script.
timurbazhirov
approved these changes
Aug 18, 2026
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.
Summary
Same root cause as mat3ra/esse#421 and mat3ra/utils#53, surfaced differently: `js/publish`'s
"Verify tests" step (`npm test`) runs before "Publish release to NPM" (where
`prepublishOnly` would fire), and this package's own test suite requires its own
freshly-built `dist/js/runtime_data/*.json` — a self-referencing import chain through
`@mat3ra/mode`, which imports back from `@mat3ra/standata/dist/js/...`.
Without a build first, #148's post-merge publish run failed entirely:
```
Cannot find module '@mat3ra/standata/dist/js/runtime_data/models/modelsTreeConfigByApplication.json'
```
(No broken package shipped this time — the failure was in the test gate, before publish ever ran.)
Fix
Add `pretest` — npm's `test` lifecycle hook (unlike `prepublishOnly`, which only fires for
`publish`/`pack`) — running the same `build` script already used by `release-wip.yml`.
Verified locally: `rm -rf dist node_modules && npm install && npm test` now builds
automatically and all 200 tests pass.