Skip to content

Conversation

@Higangssh
Copy link
Contributor

Fixes test file compilation in Docker builds by excluding test directories from tsconfig.

Description

Test files were being compiled into dist/ during build, causing TypeScript errors in Docker environments. Added exclude pattern to skip test files.

Server Details

  • Server: filesystem
  • Changes to: build configuration (tsconfig.json)

Motivation and Context

npm install triggers prepare script which runs tsc. TypeScript tried to compile test files that use vitest globals, causing:
error TS2304: Cannot find name 'afterEach'

How Has This Been Tested?

  • Local build and all tests pass
  • Docker build completes successfully
  • Verified dist/ no longer contains tests/

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
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

Added to tsconfig.json:

"exclude": [
  "**/__tests__/**",
  "**/*.test.ts",
  "**/*.spec.ts"
]

Fixes #2928

test files were being compiled into dist during build,
causing issues in docker environments. added exclude
pattern to tsconfig to skip __tests__ directory.

fixes modelcontextprotocol#2928
Copy link
Member

@olaservo olaservo left a comment

Choose a reason for hiding this comment

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

Thank you!

@olaservo olaservo merged commit 69dee42 into modelcontextprotocol:main Nov 8, 2025
19 checks 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.

server: filesystem test are failing when trying to build inside docker

2 participants