Skip to content

app/electron/cli.test.ts fails on a fresh clone: dev-resolution tests require a built dist/cli.js #681

Description

@iamtoruk

Symptom

On a fresh clone (or any checkout that has never run npm run build), npx vitest run app/electron/cli.test.ts fails 2 tests:

  • resolveCodeburnPath (Vite development) > prefers the executable repo dist/cli.js when the Vite dev server is set
  • resolveCodeburnPath (Vite development) > prefers the repo dev CLI over a persisted-path file (stale global) in dev
TypeError: .toMatch() expects to receive a string, but got object
  app/electron/cli.test.ts:47:35
  expect(resolveCodeburnPath()).toMatch(/dist\/cli\.js$/)

CI stays green because the pipeline builds before testing, so this only bites contributors running the suite locally. Reproduced on a clean checkout of main at 5869cad on 2026-07-16, and confirmed absent when dist/cli.js exists.

Root cause

The Vite-development branch of resolveCodeburnPath() only returns the repo CLI path when dist/cli.js actually exists and is executable. Without a prior build it falls through and the function returns a non-string shape, so the assertion gets an object.

Suggested fix

Have the two dev-resolution tests create the fixture they depend on: write a stub executable dist/cli.js into the temp repo root the test already controls (or chmod-touch one in a tmpdir and point resolution at it), rather than depending on the developer having built the real bundle. Skipping when the file is absent would also work but hides real resolution regressions, so a stub fixture is preferred.

Introduced in 916aa64 (Electron security + spawn efficiency batch, 2026-07-16).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions