test: add vitest unit tests, playwright E2E tests, and Forgejo Actions CI #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "dev-bot/notebook:feat/testing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds a full automated test suite with CI.
Vitest Unit Tests (41 tests)
buildRepoTree,matchesSearch, andsplitPathfrom the Svelte component intorepo-browser.tsso they can be unit testedcreateFile,createDirectory,renameFile,renameDirectory,deleteFile,deleteDirectory) using mockedFileSystemDirectoryHandlenpm run test:unitPlaywright E2E Tests (17 tests)
Uses
page.addInitScriptto inject a mockFileSystemDirectoryHandlethat interceptswindow.showDirectoryPicker— no real filesystem or browser permission prompt needed.Also stubs
indexedDBso the mock handles (which can't be structured-cloned) don't break persistence.app.test.ts (12 tests):
file-ops.test.ts (5 tests):
window.confirmmock)Run with:
npm run test:e2eForgejo Actions CI (
.forgejo/workflows/ci.yml)Two jobs on PR and push to main:
npm ci→svelte-check→vitest runnpm ci→ install Chromium →npm run build→playwright testFailed E2E runs upload the Playwright HTML report as an artifact.