@frontmcp/testing uses a fixture-based testing approach inspired by Playwright. Fixtures are pre-configured objects automatically injected into your test functions, eliminating boilerplate setup code.
Available Fixtures
Configuring Fixtures
Usetest.use() to configure fixtures for your test file:
Configuration Options
MCP Client Fixture
Themcp fixture is your primary interface for testing MCP servers.
Tools API
Resources API
Prompts API
Session & Server Info
Raw Protocol Access
Logging & Debugging
Auth Fixture
Theauth fixture creates JWT tokens for testing authentication flows.
Creating Tokens
Pre-built Test Users
Testing Edge Cases
JWKS Access
Server Fixture
Theserver fixture provides server control and multi-client support.
Server Information
Creating Additional Clients
Server Logs
Restart Server
Fixture Lifecycle
Understanding when fixtures are created and destroyed:The server is shared across all tests in a file for performance. Starting a server is expensive (100-500ms), so sharing it dramatically improves test speed.
Best Practices
Do:- Use
test.use()once at the top of each test file - Clear logs and traces between tests if needed
- Disconnect additional clients created via
server.createClient() - Use
port: 0for automatic port selection in CI
- Modify shared server state without cleanup
- Create many clients without disconnecting them
- Rely on test execution order
- Use hardcoded ports in parallel test runs