Skip to content

Conversation

jake-danton
Copy link

Followup to #916 as discussed with @KKonstantinov .

Vitest is faster than Jest (from 3.5s to 0.9s) and comes with benchmark and coverage features, smart watch mode, better ESM support, and an easy switch.

Motivation and Context

Better test tooling

How Has This Been Tested?

Running the test suite, confirming the same number of tests ran, all of them passed, and the execution time was significantly less.

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 Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@jake-danton jake-danton requested a review from a team as a code owner October 8, 2025 14:38
@Copilot Copilot AI review requested due to automatic review settings October 8, 2025 14:38
@jake-danton jake-danton requested a review from a team as a code owner October 8, 2025 14:38
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR modernizes the test infrastructure by switching from Jest to Vitest, which provides significantly faster test execution (from 3.5s to 0.9s) and includes built-in benchmark and coverage capabilities. The change improves developer productivity with enhanced testing tools while maintaining full compatibility with existing test functionality.

  • Replaced Jest test runner with Vitest for better performance and modern features
  • Added new npm scripts for benchmarking and coverage reporting
  • Updated all test files to use Vitest imports and mocking APIs

Reviewed Changes

Copilot reviewed 43 out of 45 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
vitest.config.ts New Vitest configuration with mock aliasing and coverage settings
package.json Updated dependencies and scripts to use Vitest instead of Jest
tsconfig.*.json Added .bench.ts exclusions for benchmark test files
src/**/*.test.ts Updated test imports and mocking to use Vitest APIs
eslint.config.mjs Added .bench.ts to ignored patterns
CLAUDE.md Updated documentation to reflect new testing commands

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

- run: npm run build
- run: npm test
- run: npm run test:coverage
- uses: davelosert/vitest-coverage-report-action@v2
Copy link
Member

Choose a reason for hiding this comment

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

Not sure about using a 3rd party GitHub Action, and whether this will create comment spam on PRs. Up to TypeScript SDK maintainers though.

We also might want to pin the version

Copy link
Contributor

Choose a reason for hiding this comment

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

Was also thinking about this.

We can get coverage sorted without it.

"outDir": "./dist/esm"
},
"exclude": ["**/*.test.ts", "src/__mocks__/**/*"]
"exclude": ["**/*.bench.ts", "**/*.test.ts", "src/__mocks__/**/*"]
Copy link
Contributor

Choose a reason for hiding this comment

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

What is bench.ts? Since we dont have any benchmark tests, should we keep it?

- run: npm run build
- run: npm test
- run: npm run test:coverage
- uses: davelosert/vitest-coverage-report-action@v2
Copy link
Contributor

Choose a reason for hiding this comment

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

Was also thinking about this.

We can get coverage sorted without it.

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.

3 participants