Skip to content

Conversation

@olaservo
Copy link
Member

@olaservo olaservo commented Oct 19, 2025

Fixes: #2882

Description

This PR migrates the test frameworks for the sequentialthinking and filesystem servers from Jest to Vitest. This migration provides faster test execution, better ESM support, and a more modern testing experience while maintaining 100% test compatibility.

I also added a AGENTS.md file which gets imported into a repo-level CLAUDE.md as well, to help refer agents to the preferred test framework and contributing guidelines that humans might miss.

Server Details

  • Server: sequentialthinking, filesystem
  • Changes to: Test infrastructure, dependencies, configuration files

Motivation and Context

The current Jest setup with ts-jest requires extensive configuration to handle ESM modules, leading to:

  • Complex jest.config.cjs files with module mappers and transform patterns
  • Additional dependencies (ts-jest, ts-node)
  • Slower test execution
  • More maintenance overhead

This migration simplifies the testing infrastructure while maintaining the same test coverage and reliability.

How Has This Been Tested?

All tests have been executed successfully with Vitest.

Breaking Changes

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the server's README accordingly (N/A - no README changes needed for test framework)
  • I have tested this with an LLM client (N/A - this is test infrastructure only)
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling (N/A - test infrastructure change)
  • I have documented all environment variables and configuration options (N/A - no new env vars)

olaservo and others added 4 commits October 12, 2025 18:07
- Replace Jest dependencies with Vitest and @vitest/coverage-v8
- Update test scripts to use 'vitest run --coverage'
- Create vitest.config.ts for both servers with node environment and coverage settings
- Update all test files:
  - Change imports from '@jest/globals' to 'vitest'
  - Replace jest.mock() with vi.mock()
  - Replace jest.fn() with vi.fn()
  - Update mock clearing/restoring to use vi methods
- Remove jest.config.cjs files
- All 151 tests passing (24 in sequentialthinking, 127 in filesystem)

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

Co-Authored-By: Claude <[email protected]>
@olaservo olaservo marked this pull request as ready for review October 19, 2025 18:38

## Testing

Use vitest when configuring or adding tests for servers implemented in typescript.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this applies to both humans + agents I might move this to README/CONTRIBUTING directly

@@ -0,0 +1,9 @@
# MCP Reference Server Development Guide
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? From my experience most coding agents seem to already read README + CONTRIBUTING.

Copy link
Member

@domdomegg domdomegg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

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.

Convert reference server tests to use vitest instead of jest

3 participants