First frontend unit test framework on Lumotia. Pinned exact versions for supply-chain hygiene (matches the rust-toolchain.toml discipline from the27661c8hygiene pass and the npm audit signatures pre-flight frome4d56b8): - vitest 4.1.6 (compatible with vite 6, supports vite 6/7/8) - jsdom 29.1.1 Installed with `npm install --save-dev --save-exact --ignore-scripts` per the install discipline documented in the README — the --ignore-scripts flag blocks the postinstall vector that npm worms (Shai-Hulud, mini-Shai-Hulud) rely on. vite.config.js: - Switched defineConfig import to vitest/config (superset of vite/config; production builds ignore the `test` key). - test.environment = "jsdom" so storage-shim tests drive real browser APIs. - test.include scoped to src/**/*.{test,spec}.{ts,js} — colocated with source, mirrors the Rust #[cfg(test)] sibling pattern. - test.exclude blocks src-tauri/ (owned by cargo test). - restoreMocks + clearMocks + unstubAllGlobals on so module-level state can't leak between tests. src/lib/utils/localStorageMigration.test.ts — 12 tests: migrateLocalStorageKey: - copies value + removes old when only old exists - removes old + keeps new when both exist (lumotia is authoritative) - no-op when only new exists - no-op when neither exists - idempotent (second call after first migrates nothing) - preserves the value's exact bytes (no JSON round-trip) - preserves empty-string values (distinct from null) - survives DOMException / quota errors without re-raising - no-op when localStorage is undefined (SSR-safe) migrateLocalStorageKeys: - processes pairs in order - per-pair failure does not strand remaining pairs (resilience) - empty pairs list is a clean no-op package.json: - "test": "vitest run" (one-shot, CI-friendly) - "test:watch": "vitest" (dev loop) README: documents `npm run test` alongside `cargo test --workspace` and `npm run check` in the Testing section. Verification: - npm run test: 12/12 pass - npm run check: 0 errors, 0 warnings (the new .ts test type-checks clean against jsconfig.json's strict typescript settings)
45 lines
1.3 KiB
JSON
45 lines
1.3 KiB
JSON
{
|
|
"name": "lumotia",
|
|
"version": "0.1.0",
|
|
"description": "Lumotia — Think out loud",
|
|
"type": "module",
|
|
"scripts": {
|
|
"dev": "npm run dev:frontend",
|
|
"dev:frontend": "svelte-kit sync && vite dev",
|
|
"dev:tauri": "./run.sh",
|
|
"build": "vite build",
|
|
"preview": "vite preview",
|
|
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
|
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"tauri": "tauri"
|
|
},
|
|
"license": "MIT",
|
|
"dependencies": {
|
|
"@chenglou/pretext": "0.0.5",
|
|
"@tauri-apps/api": "2.10.1",
|
|
"@tauri-apps/plugin-autostart": "^2.5.1",
|
|
"@tauri-apps/plugin-dialog": "^2.7.1",
|
|
"@tauri-apps/plugin-global-shortcut": "^2.3.1",
|
|
"@tauri-apps/plugin-notification": "^2.3.3",
|
|
"@tauri-apps/plugin-opener": "^2",
|
|
"lucide-svelte": "^0.577.0",
|
|
"svelte-i18n": "^4.0.1"
|
|
},
|
|
"devDependencies": {
|
|
"@sveltejs/adapter-static": "^3.0.10",
|
|
"@sveltejs/kit": "^2.58.0",
|
|
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
|
"@tailwindcss/vite": "^4.2.1",
|
|
"@tauri-apps/cli": "^2",
|
|
"jsdom": "29.1.1",
|
|
"svelte": "^5.0.0",
|
|
"svelte-check": "^4.0.0",
|
|
"tailwindcss": "^4.2.1",
|
|
"typescript": "~5.6.2",
|
|
"vite": "^6.4.2",
|
|
"vitest": "4.1.6"
|
|
}
|
|
}
|