Skip to content

fix: complete mock.module() exports to prevent CI test failures#11

Merged
guo-yu merged 1 commit intochekusu:mainfrom
Digidai:fix/ci-test-mocks
Mar 31, 2026
Merged

fix: complete mock.module() exports to prevent CI test failures#11
guo-yu merged 1 commit intochekusu:mainfrom
Digidai:fix/ci-test-mocks

Conversation

@Digidai
Copy link
Copy Markdown
Contributor

@Digidai Digidai commented Mar 29, 2026

Summary

  • Add missing waitForCode to all receive.js mock.module() calls in cli.test.ts
  • Add missing saveConfig, getConfigValue, setConfigValue, resolveApiKey, CONFIG_DIR, CONFIG_FILE to all config.js mock.module() calls in cli.test.ts
  • Simplify release.yml test step: use glob pattern (bun test test/unit/) instead of explicit file list

Root cause

Bun's mock.module() replaces the module in the global registry. When a mock is missing exports that other test files import (e.g. waitForCode from receive.js, resolveApiKey from config.js), those tests fail with SyntaxError: Export named 'X' not found in CI where all files run in the same process.

Test plan

  • bun test test/unit/ passes locally (217 tests, 0 failures)
  • bun test test/e2e/flow.test.ts test/e2e/sqlite-search.test.ts passes (16 tests)

Generated with Claude Code

- Add missing waitForCode to all receive.js mock.module() calls in cli.test.ts
- Add missing saveConfig, getConfigValue, setConfigValue, resolveApiKey,
  CONFIG_DIR, CONFIG_FILE to all config.js mock.module() calls in cli.test.ts
- Simplify release.yml test step: use glob pattern (bun test test/unit/)
  instead of explicit file list to auto-include new test files

Bun's mock.module() replaces the module in the global registry. When a mock
is missing exports that other test files import, those tests fail with
"Export named 'X' not found" in CI where all files run in the same process.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@guo-yu guo-yu merged commit 7c6163c into chekusu:main Mar 31, 2026
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.

2 participants