Skip to content

fix: resolve CI test failures on Linux runner#19

Closed
Tsutomu-miku wants to merge 2 commits intoHOOLC:masterfrom
Tsutomu-miku:fix/test-case
Closed

fix: resolve CI test failures on Linux runner#19
Tsutomu-miku wants to merge 2 commits intoHOOLC:masterfrom
Tsutomu-miku:fix/test-case

Conversation

@Tsutomu-miku
Copy link
Copy Markdown
Contributor

Summary

Fixes CI pipeline failures introduced after PR #13 was merged. The GitHub Actions runner (Linux) caused multiple test failures due to platform-specific assumptions and incorrect test framework imports.

Root Causes & Fixes

1. tests/cli-launch.test.ts — 9 test failures

Cause: All launch tests assumed macOS (darwin) platform, but CI runs on Linux where codexm launch now correctly rejects with "not supported on Linux".
Fix: Added setPlatformForTesting("darwin") in beforeEach/afterEach hooks so launch tests run under simulated macOS environment.

2. tests/codex-cli-runner.test.tsCannot find module 'vitest'

Cause: Tests were written with vitest imports, but the project uses @rstest/core.
Fix: Migrated all vi.fn()rs.fn(), vi.mock()rs.mock(), vi.useFakeTimers()rs.useFakeTimers(). Also corrected mock paths.

3. src/main.tsrun command using non-existent API

Cause: store.getCurrentAccountInfo?.() does not exist in the codebase.
Fix: Changed to store.getCurrentStatus() which exists and returns { account_id, ... }.

4. src/main.tsresolveManagedDesktopState missing parameter

Cause: Function body referenced launchPlatform but it was not declared as a parameter.
Fix: Added launchPlatform: CodexmPlatform = "darwin" as an explicit parameter.

5. src/cli/args.ts & src/cli/help.tsrun command not registered

Fix: Added "run" to command registration and help output.

6. Testability improvements

  • codex-cli-watcher.ts: AbortSignal-aware delay(), injectable isProcessAliveImpl
  • Test files: fake timers, proper stubs, command-sync test

Changed Files

File Change
src/main.ts Fix resolveManagedDesktopState param, fix run command API
src/cli/args.ts Register run command
src/cli/help.ts Add run to help text
src/codex-cli-watcher.ts AbortSignal-aware delay, injectable isProcessAliveImpl
tests/cli-launch.test.ts Platform override for CI
tests/codex-cli-runner.test.ts Migrate vitest → @rstest/core
tests/codex-cli-watcher.test.ts Fake timers, DI for process checks
tests/cli-read-commands.test.ts Command-sync test, stubs
tests/cli.test.ts Test config stubs

- add the run command to parser metadata and help output, and add a coverage test that keeps implemented commands, parser command names, and help text in sync
- source codexm run account context from getCurrentStatus, pass the resolved launch platform through managed Desktop state checks, and make CLI watcher delays abortable with injectable process liveness checks
- harden tests by restoring mocked platform state, isolating current --json from live runtime reads, and aligning runner/watcher suites with the current rstest setup
- bump the package version to 0.0.18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant