Targ Apps Docs
Chroma-Fs

Testing

Vitest suite, coverage targets, and how to run Chroma-Fs tests locally.

Chroma-Fs uses Vitest with fake-indexeddb for unit and integration tests. Filesystem tests mock the Tauri adapter so CI and local runs do not require a Tauri host.

Commands

From the Chroma-Fs directory:

npm install
npm run build
npm test              # run once
npm run test:watch    # watch mode
npm run test:coverage # coverage report (v8)
npm run typecheck

Test layout

PathScope
test/path.test.tsPath normalization helpers
test/config.test.tsConfig parsing, platform detection, backend resolution
test/indexeddb.test.tsIndexedDB backend + shared storage contract
test/filesystem.test.tsFilesystem backend with mock Tauri adapter
test/integration.test.tscreateStorage() config switching and fetch-based config
test/helpers/storage-contract.tsShared CRUD contract exercised on both backends
test/helpers/mock-tauri-adapter.tsIn-memory Tauri FS mock

What is covered

  • IndexedDB backend — read/write text and binary, mkdir, list, delete, rmdir (recursive), path normalization, error cases.
  • Filesystem backend — same contract via injected TauriFsAdapter mock (no real @tauri-apps/plugin-fs in tests).
  • Unified APIrunStorageContract() runs identical assertions against both backends.
  • Configuration — inline config, configPath + fetch, platform defaults (static → IndexedDB, desktop → filesystem).

Coverage notes

Coverage is reported for src/**/*.ts. Bridge (post-message-adapter) and default Tauri wrapper paths are exercised in desktop integration, not in unit tests. Target for core backends and config is >85% line coverage on src/backends/ and src/config.ts.

Dev mode verification (ecosystem)

Dynamic template projects with "dev": { "desktop": true } in chroma.json trigger chroma dev to:

  1. Start the engine dev server on the configured port.
  2. Launch Chroma Desktop with --develop --url http://127.0.0.1:<port>/<entry> --title <name>.

Chroma Desktop reads develop mode from CLI args or get_develop_mode, hides the library menu, and loads the project URL directly. Use chroma dev --no-desktop to skip the desktop shell.

On this page