Repository navigation
test: add coverage and improve tests - #218
Conversation
a5d62c0 to
bd13bb6
Compare
bd13bb6 to
60e2bb6
Compare
60e2bb6 to
0b5e61b
Compare
0b5e61b to
778045e
Compare
- code: checks wait with vi.waitFor and longer timeouts under coverage - e2e: the tutorial copy gets its own nf, check-build watches tutorial - knip: mkfifo used by the fs tests - command-palette: cover the keyboard shortcuts rows
778045e to
9a299b7
Compare
Tchips46
left a comment
There was a problem hiding this comment.
Review: tests and coverage (9a299b7)
Line numbers are at this PR's head. Most of the new specs are sound, and splitting the long git e2e test into independent ones is a good change. The findings below are about the CI wiring, the e2e fixtures, and some production code that ships inside this test PR.
Should fix
1. Account sync status hides errors, and saved() can return before anything was pushed (packages/settings/src/account-sync/account-sync-store.ts:112, apps/editor/src/lib/editor/follow-saved.ts:15)
write()now sets the status topendingunless it issyncing. When the status waserror(for example "too large to sync") orconflict, any edit replaces it with "Changes waiting to sync", and the error text, which only shows while the status iserror, disappears.followSavedcountsofflineanderroras saved. In e2e, a failed or offline push makessaved()return at once, which is the stale-account leak between tests that this helper exists to prevent.- Fix: switch to
pendingonly fromidle. Treatofflineanderroras not saved, sosaved()times out loudly.
2. A PR that only moves the engine or CLI pin never runs e2e (.github/workflows/e2e.yml:9-19)
scripts/**is not in thepathslist, butscripts/pinned-refs.jsonnow picks the engine and CLI that e2e builds, andscripts/engine-bridge.mjsdrives the workspace setup.- Example: a PR that bumps only the pin is merged with no e2e run, and a bad pin first fails in the nightly run on main.
- Fix: add
'scripts/**'topaths.
3. Game cleanup failures are swallowed, and the scene spec now cleans up while the game plays (apps/editor/e2e/test.ts:35-47, apps/editor/e2e/scene.spec.ts)
- Every step of the new
stopsTheGamefixture ends in.catch(() => undefined). When Stop hangs, the test passes, and the next test fails with the "server exits at once" cascade that CLAUDE.md warns about, which hides the real cause. scene.spec.tsdropped its own stop hook. Playwright runsafterEachhooks before fixture teardown, so the spec now restores the breakout sources, resets the layout and callssaved()while the game is still playing.- Fix: drop the
.catchon the wait for the Play button. Keep the scene spec's own stop, or stop the game first in itsafterEach.
4. The keymap test asserts on its own mock (plugins/command-palette/test/keymap/keymap-rows.spec.ts:13-31)
- The mock of
@nanoforge-dev/editor-sdk/uirewritesbindingsConflictandfindConflictsasa.key === b.key. The real code (packages/ui/src/workbench/keybinding/resolve-keymap.ts:89) also checkswhenoverlap and chord prefixes (Mod+KagainstMod+K S). - The conflict assertions pass whatever the real functions return, so a regression in conflict detection ships with green tests.
- Fix: have the mock factory re-export the real pure functions from
resolve-keymap.tsandkeystroke.ts.
5. One turbo cache key per commit is shared by four jobs, and the cache only grows (.github/actions/prepare/action.yml, "Cache turbo")
- Lint, typecheck, unit and e2e all save under
turbo-<ref_name>-<sha>, and only the first job to finish wins: the other jobs' task results are lost and rerun next time. - Each run restores the previous
.turbo/cacheand saves it again with more in it. Near GitHub's 10 GB limit this evicts the engine, Playwright and pnpm caches. - Fix: add the job name to the key, and clear
.turbo/cachebefore saving (or drop the cross-branch restore fallback).
6. Production changes are hidden under a test: commit
- This PR also changes production code: the diff editor fix (
plugins/code-editor/src/monaco/dispose-diff-editor.ts), theSettingsService.pending/holdcounters with holds inLayoutControllerandWorkbenchService,data-nf-savedon every page, the sync status change from point 1, and about 50 removed exports. cliff.tomlfiles^testcommits under "Testing", so the Monaco fix never shows as a fix in the changelog. CLAUDE.md also asks for core changes first, in their own commits.- Fix: split out
fix(code-editor),feat(settings)/feat(ui)andrefactorcommits.
Nice to have
check-build(apps/editor/e2e/check-build.ts:6-13, 57) countstoolingsources as editor sources, but the command it prints (--filter=@nanoforge-dev/editor...) does not rebuildtooling/example-plugin. After an edit there, the check keeps failing or passes with a stale dev plugin. Fix: add--filter=./tooling/*to the printed command.- Duplicates and leftover sleeps:
plugins/code-editor/test/document/editor-document.spec.ts:9-27andtype-libraries.spec.ts:8-40rebuild the fake model thatplugins/code-editor/test/fixtures/fake-monaco.ts(added in this PR) already provides.inspectors.spec.ts:31-37repeats the newstopsTheGamefixture.inspectors.spec.ts:28andproject.spec.ts:37still sleep 900 ms wheresaved()now covers it.
Not checked: nothing was run locally. CI is green on this head (e2e: 102 passed, 0 skipped).
- settings: a write only turns an idle sync status pending, so an error or conflict stays shown; follow-saved counts only idle and conflict as saved, so saved() times out on a failed or offline push - ci: run e2e when scripts/ change (engine and CLI pins); one turbo cache per job and month - e2e: the stopsTheGame fixture fails when Stop does not stop the game (shared stopGame helper); the scene spec stops the game before restoring sources; inspectors drops its duplicate stop hook and waits for saved() instead of 900 ms - e2e: check-build prints a rebuild command that includes tooling/ - code-editor: editor-document spec uses the shared fakeModel fixture Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review. Addressed in 1d26f8e ( Fixed
Not changed
Checked at the top of the stack: lint, typecheck and unit tests pass, and e2e passed 109/109 (0 skipped) against the CI-pinned engine and CLI. |
What does this PR do?
Add coverage and improve tests
How do you test this PR?