Skip to content

Test coverage for the Electron main process #58

Description

@rebaserHEAD

electron/*.cjs has zero coverage: Vitest only includes src/**, and tsc doesn''t check the CJS files, so main-process logic is the one part of the app where regressions ship blind. It''s no longer trivial logic either: fork resolution and discovery (loadForkFromDir, handleDiscoverForks), the settings round-trip, path-containment checks in the app:// file serving, and the unsaved-close guard.

  • Extract the pure logic (fork test, discovery scan, path containment, MIME mapping) into a requireable module that both main.cjs and Vitest can load; keep the Electron-API wiring thin.
  • Unit-test the extracted logic; the path-containment ("never serve outside dist/ or the fork root") checks are the ones that most deserve tests.
  • Full Electron integration tests (spectron-style) are out of scope; this is about the logic, not the shell.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions