Skip to content

fix: build before running tests via pretest (broken publish gate) - #149

Merged
k0stik merged 1 commit into
mainfrom
fix/pretest-build
Aug 18, 2026
Merged

fix: build before running tests via pretest (broken publish gate)#149
k0stik merged 1 commit into
mainfrom
fix/pretest-build

Conversation

@k0stik

@k0stik k0stik commented Aug 18, 2026

Copy link
Copy Markdown
Member

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.

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.
@k0stik
k0stik merged commit e762303 into main Aug 18, 2026
10 checks passed
@k0stik
k0stik deleted the fix/pretest-build branch August 18, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants