Repository navigation
ci(test): run suites against pre-built dist to skip repeated rebuilds - #587
Merged
Merged
Conversation
The CI test job ran `npm run build` and then `npm run test`, but the root `test` script delegates to each workspace's own `test`, which all do `clean && build` first. That discarded the dist just built and rebuilt every package a second time, so the build effectively ran twice in one job (~44s build + ~111s test, the latter mostly rebuild). Add `test:dist`: assumes `npm run build` already ran, runs the suites directly against dist. The six node packages run `node --test` against their dist; headless reuses its git-isolated runner; desktop keeps its own `test` script, because its main tests import renderer modules that `tsc` emits under dist/renderer during `build:main`, which the subsequent `build:renderer` (vite) clears — so desktop must `clean:main && build:main` once more to re-materialize them before testing. Local run: test:dist 4863 tests / 0 fail in ~25s, versus the old rebuild+test ~111s.
This was referenced Jul 6, 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
CI
testjob rannpm run buildand thennpm run test. The roottestscript delegates to each workspace's owntest, which all doclean && buildfirst, so the dist just built got thrown away and every package was rebuilt a second time. Build effectively ran twice in the job.Adds a
test:distscript that assumesnpm run buildalready ran and runs the suites directly against dist, and switches the CItestjob to it.Why
The
testjob was the CI bottleneck (~185s wall, vs ~91s for typecheck/e2e), and most of itsteststep (~111s) was rebuild, not testing. The repeated build is pure waste.Measured on the last green run:
npm run buildnpm run test(incl. per-workspace clean+build+test)Scope
Changed:
package.json: newtest:distscript..github/workflows/ci.yml:testjob runsbuildthentest:distinstead oftest.Not included:
typecheckande2ejobs untouched.testscript is kept as-is so localnpm test/npm --workspace X teststays self-contained (still clean+build+test per workspace).How test:dist is built
node --test "dist/**/*.test.js"in their own workspace cwd (same glob and cwd as theirtestscript), so no rebuild and behavior is identical.scripts/run-headless-tests.mjs(git-config isolation).testscript (clean:main && build:main && node --test dist/main). Its main tests import renderer modules thattscemits underdist/rendererduringbuild:main, which the subsequentbuild:renderer(vite) clears. So desktop must re-runbuild:mainbefore testing — this is inherent to how the package is wired, not something to fold into the skip.Verification
In a clean worktree (branch off
main):npm run buildthennpm run test:dist→ 4863 tests, 0 fail, exit 0, ~25s.test(same globs/scripts).process.cwd()differed; the-wform restores each workspace's cwd and they pass.Expected CI effect:
testjob steptest:dist≈ 25–35s instead of 111s; job wall roughly halved.User-facing impact
None. CI/dev scripts only; no shipped behavior change.
Reviewer notes
tscside-effects that vite wipes.test:distrequires a priornpm run build; the CI job keeps thebuildstep right before it, and a comment notes this.Checklist