Skip to content

test: improve test coverage for server scenarios#179

Open
schlpbch wants to merge 3 commits intomodelcontextprotocol:mainfrom
schlpbch:test/improve-coverage
Open

test: improve test coverage for server scenarios#179
schlpbch wants to merge 3 commits intomodelcontextprotocol:mainfrom
schlpbch:test/improve-coverage

Conversation

@schlpbch
Copy link

@schlpbch schlpbch commented Mar 3, 2026

Summary

Add comprehensive test suite for server scenario lifecycle and properties to improve code coverage.

  • Add 42 tests covering 4 main scenario implementations
  • Test scenario properties (name, description, specVersions)
  • Test lifecycle methods (start, stop, getChecks)
  • Test start/stop cycles with proper cleanup
  • Test spec version validation and formatting
  • Test scenario descriptions and naming conventions
  • Verify scenario independence and construction

Test Coverage

  • All 126 tests pass
  • 42 new tests added
  • Covers scenario initialization, lifecycle, and property validation

Files Changed

  • Added: src/scenarios/server/index.test.ts (332 lines, 42 tests)

Test Plan

  • Run pnpm test - all 126 tests pass
  • Run pnpm test:coverage - coverage report generated
  • Verify scenario lifecycle methods work correctly
  • Test multiple start/stop cycles
  • Verify spec version validation

🤖 Generated with Claude Code

schlpbch and others added 3 commits March 3, 2026 23:03
- Install @vitest/coverage-v8 provider for code coverage analysis
- Add coverage configuration to vitest.config.ts with v8 provider
- Generate coverage reports in text, JSON, and HTML formats
- Exclude node_modules, dist, test files, and examples from coverage
- Add npm script 'test:coverage' to run tests with coverage reporting

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add 42 tests covering InitializeScenario, ToolsCallScenario, SSERetryScenario, and ElicitationClientDefaultsScenario
- Test scenario properties (name, description, specVersions)
- Test scenario lifecycle methods (start, stop, getChecks)
- Test start/stop cycles and server URL generation
- Test checks collection and spec version support
- Test scenario descriptions and naming conventions
- Test scenario construction and independence

This improves coverage for scenario initialization and lifecycle code paths.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Ignore generated coverage reports from vitest to avoid committing
build artifacts and maintaining a cleaner repository state.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@schlpbch
Copy link
Author

schlpbch commented Mar 3, 2026

@maciej-kisiel could you please review this PR?

@maciej-kisiel
Copy link
Contributor

@schlpbch I don't mean this in any wrong way, but may I ask you to provide more details why you need a review from my side? I'm not a maintainer of this repository, so I have to say I'm a bit surprised by the request :)

@schlpbch
Copy link
Author

schlpbch commented Mar 4, 2026 via email

@maciej-kisiel
Copy link
Contributor

No worries! Based on my information @pcarleton is the main maintainer of this repository.

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