# Testing signals — farion1231/cc-switch

> Canonical page: https://codevetter.com/unpack/cc-switch/testing-signals

# Testing signals — farion1231/cc-switch

Scanned commit 09c5d39d8c3cf44b1bdfd0c6432c46495e546578 (2026-09-22). Generated by codevetter codevetter 1.12.0 on 2026-09-22.

Frontend tests are Vitest 2 with jsdom, Testing Library, and MSW, configured in vitest.config.ts and rooted in tests/. Backend tests are cargo test: large module-level Rust tests plus integration binaries in src-tauri/tests that drive the library through test-hooks. CI runs both on pull requests when the matching paths change, and always on pushes to main. There is no browser or Tauri-driver end-to-end job. Coverage exists as a Vitest reporter option but is not a CI gate.
- vitest.config.ts uses @vitejs/plugin-react, alias @ to ./src, environment jsdom, globals, setup files tests/setupGlobals.ts and tests/setupTests.ts, and coverage reporters text and lcov. package.json test:unit is vitest run; test:unit:watch is vitest watch. — [vitest.config.ts](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/vitest.config.ts) [package.json](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/package.json)
- tests/setupTests.ts starts an MSW server with onUnhandledRequest warn, initializes i18next with empty zh and en catalogs, and after each test runs Testing Library cleanup, resetProviderState, server.resetHandlers, and vi.clearAllMocks. Tauri is mocked from tests/msw/tauriMocks. — [tests/setupTests.ts](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/tests/setupTests.ts)
- Frontend test dirs are tests/components, tests/config, tests/hooks, tests/integration (App.test.tsx and SettingsDialog.test.tsx), tests/lib, tests/msw, tests/types, and tests/utils. Config tests include codexProviderPresets, codingPlanProviders, grokBuildProviderPresets, jiekouProviderPresets, and ppioProviderPresets. — [tests/setupTests.ts](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/tests/setupTests.ts) [src/config/codexProviderPresets.test.ts](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/src/config/codexProviderPresets.test.ts)
- Rust dev-dependencies are serial_test and tempfile. Feature test-hooks is off by default. switch_provider_test_hook and import_default_config_test_hook are the integration entry points; they call the same internals as the Tauri commands. src-tauri/tests/provider_commands.rs imports them from cc_switch_lib and uses a process-wide test mutex plus CC_SWITCH_TEST_HOME. — [src-tauri/Cargo.toml#L18-20](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/src-tauri/Cargo.toml#L18-L20) [src-tauri/Cargo.toml#L119-121](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/src-tauri/Cargo.toml#L119-L121) [src-tauri/src/commands/provider.rs#L101-116](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/src-tauri/src/commands/provider.rs#L101-L116) [src-tauri/tests/provider_commands.rs#L1-40](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/src-tauri/tests/provider_commands.rs#L1-L40)
- Integration test files under src-tauri/tests cover app config load, app type parse, deeplink import, Hermes roundtrip, import/export sync, mcode commands, MCP commands, profile roundtrip, prompt live sync, provider commands, provider service, proxy commands, and skill sync, with a shared support.rs. — [src-tauri/tests/provider_commands.rs](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/src-tauri/tests/provider_commands.rs) [src-tauri/tests/deeplink_import.rs](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/src-tauri/tests/deeplink_import.rs) [src-tauri/tests/proxy_commands.rs](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/src-tauri/tests/proxy_commands.rs) [src-tauri/tests/skill_sync.rs](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/src-tauri/tests/skill_sync.rs)
- Home-directory isolation for tests is CC_SWITCH_TEST_HOME inside get_home_dir(). Windows CI can also set CC_SWITCH_WSL_TEST_DIR. Comments in skill and session-usage tests warn that calling dirs::home_dir() directly bypasses the override and will touch the real user profile. — [src-tauri/src/config.rs#L18-33](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/src-tauri/src/config.rs#L18-L33) [src-tauri/src/services/skill.rs#L6550-6568](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/src-tauri/src/services/skill.rs#L6550-L6568)
- CI frontend job runs typecheck, Prettier, and Vitest, not cargo. Backend jobs run fmt, clippy -D warnings, and cargo test after creating an empty dist/ directory so the Tauri build script has a frontend placeholder. Pull requests skip a side when paths-filter says it did not change. — [.github/workflows/ci.yml#L34-153](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/.github/workflows/ci.yml#L34-L153)
- Database::memory() builds an in-memory rusqlite connection with the same schema and change hook for unit tests. schema and DAO behavior also live in src-tauri/src/database/tests.rs. Proxy switch behavior has an in-module test switch_proxy_target_updates_live_backup_when_taken_over. — [src-tauri/src/database/mod.rs#L185-200](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/src-tauri/src/database/mod.rs#L185-L200) [src-tauri/src/services/proxy.rs#L7571-7571](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/src-tauri/src/services/proxy.rs#L7571-L7571)
- CONTRIBUTING lists pnpm lint and locale files at src/locales/{en,zh,ja}/translation.json. package.json has no lint script, and the real catalogs are src/i18n/locales/{en,zh,zh-TW,ja}.json loaded by src/i18n/index.ts. The documented pre-submit command that matches the repo is pnpm typecheck && pnpm format:check && pnpm test:unit, then cargo fmt --check, clippy, and cargo test. — [CONTRIBUTING.md#L45-92](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/CONTRIBUTING.md#L45-L92) [CONTRIBUTING.md#L119-128](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/CONTRIBUTING.md#L119-L128) [package.json](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/package.json) [src/i18n/index.ts#L1-11](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/src/i18n/index.ts#L1-L11)
- No workflow file in the CI or release paths starts a Tauri webview, Playwright, or browser suite. UI behavior of invoke-backed screens is covered only through MSW mocks of the Tauri API. Proxy protocol conversion and live-file takeover are covered by Rust tests, not by a running Axum server in CI. — [.github/workflows/ci.yml#L55-153](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/.github/workflows/ci.yml#L55-L153) [tests/setupTests.ts](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/tests/setupTests.ts) [vitest.config.ts](https://github.com/farion1231/cc-switch/blob/09c5d39d8c3cf44b1bdfd0c6432c46495e546578/vitest.config.ts)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
