Skip to content

Fix start.test.ts to match updated signal handling#122

Merged
mcollina merged 1 commit intomainfrom
fix/update-start-test-signal-handling
Oct 31, 2025
Merged

Fix start.test.ts to match updated signal handling#122
mcollina merged 1 commit intomainfrom
fix/update-start-test-signal-handling

Conversation

@mcollina
Copy link
Copy Markdown
Member

Summary

Updated test/start.test.ts to work with the new signal handling implementation in lib/start.js that uses process.once('SIGINT') instead of close-with-grace.

Changes

  • Removed close-with-grace mocking: The library is no longer used in the implementation
  • Added client.close() mocking: Properly mocks and verifies client.close() is called before server.close()
  • Updated signal handling tests: Changed from testing close-with-grace to testing process.once('SIGINT')
  • Fixed timeout handling: Added mocks for setTimeout and clearTimeout to prevent the 10-minute recording timeout from hanging tests
  • Combined test cases: Merged two separate tests into one to avoid module caching issues with Node.js experimental module mocking
  • Added setupSignals verification: Ensures create is called with setupSignals: false

Test Results

All CLI tests now pass:

# tests 6
# suites 3
# pass 6
# fail 0

Test Coverage

The updated test verifies:

  • Server starts with the correct runtime (test/start.test.ts:145-160)
  • Record mode functionality with proper request handling (test/start.test.ts:197-204)
  • SIGINT signal handling and cleanup sequence (test/start.test.ts:210-234)
  • Client and server are properly closed in the correct order (test/start.test.ts:229-234)

🤖 Generated with Claude Code

Updated the test to work with the new signal handling implementation that uses
process.once('SIGINT') instead of close-with-grace. The test now properly:
- Removes close-with-grace mocking
- Mocks client.close() and verifies it's called before server.close()
- Simulates SIGINT using process.emit()
- Mocks setTimeout/clearTimeout to prevent test hangs
- Combines both test scenarios into one to avoid module caching issues

All CLI tests now pass (6/6).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@mcollina mcollina merged commit f3c2727 into main Oct 31, 2025
1 check passed
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