test: add Vitest client-side test suite + CI#21
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add vitest resolver aliases + inert stubs for the SvelteKit virtual modules $app/stores and $env/dynamic/public so the page component can be transformed under the plain svelte plugin; per-test vi.doMock overrides them at runtime. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add ambient import so @testing-library/jest-dom matcher types reach the type checker (runtime registration is in vitest-setup.ts, which sits outside svelte-check's include). Pass the full PageData shape to the page render so svelte-check accepts the fixture. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Restore mocks/globals before clearing localStorage so an SSR-guard test that stubs localStorage to undefined cannot break teardown for later tests. Removes the per-test unstub workaround in demoCache.test.ts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
NivGreenstein
approved these changes
Jul 21, 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
demoCachestorage util,demoIndexJTD schema,flems.svelteeditor wrapper, and the demo+page.svelte(cache banner, debounced save, clear-confirm, route-change reload).+page.svelteis tested by mocking the Flems child +$app/stores+$env/dynamic/public; the real editor is never mounted.testjob topull-request.yamlso the suite runs on every PR.Notes
@testing-library/svelte@^4andvitest@^1— v5 of testing-library needs Svelte 5; this repo is Svelte 3.59. The v5-onlysvelteTesting()plugin is replaced byresolve.conditions: ['browser']+ the@testing-library/svelte/vitestsetup entry.$app/stores,$env/dynamic/public) are aliased to inert stubs so Vite can transform components under the plainsvelte()plugin; per-testvi.doMocksupplies the real behavior.saveCachestores a bare JSON array (not{ files, savedAt }), anddebounceMs = 0is accepted (only NaN/negative fall back to 500).Test Plan
npm run test→ 28/28 passnpm run check(svelte-check) → 0 errorsRun Vitestjob green on this PR🤖 Generated with Claude Code