-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Improve TypeScript setup documentation
Issue
I've been using Mocha with TypeScript in several projects and noticed the documentation could be clearer for developers getting started with this combination. While the current docs mention TypeScript briefly, there's room for improvement in helping developers avoid common setup pitfalls.
Current challenges I've observed:
- Initial setup confusion: Getting ts-node working correctly with Mocha
- Configuration questions: Proper tsconfig.json settings for testing
- Type import issues: How to properly import Mocha's types
- Common errors: "Cannot find module" and compilation issues
I see these questions regularly on Stack Overflow and in Discord, which suggests the documentation could be more helpful.
What I'd like to contribute
I'd like to add a focused TypeScript setup guide that covers the most common use cases and pain points I've encountered:
- Clear setup section in existing docs - step-by-step TypeScript + Mocha setup
- Common configuration examples - working tsconfig.json and .mocharc.json examples
- Troubleshooting section - solutions to the most frequent issues I've seen
- Simple working examples - a few practical test files that demonstrate the setup
This would be focused and practical rather than comprehensive - just enough to get developers past the initial hurdles.
Why this would be helpful
From my experience and what I've seen in community discussions:
- Reduces the "TypeScript + Mocha not working" support questions
- Gets developers productive faster with a working setup
- Shows Mocha works great with TypeScript (which isn't always obvious)
- Could reduce some of the migration to other test runners
Implementation approach
I'm thinking of a focused addition to the existing documentation rather than a massive overhaul:
- Add a "TypeScript" section to the current docs
- Include 2-3 working configuration examples
- Add a simple troubleshooting section for common issues
- Maybe add one or two example test files to the examples directory
I'd keep it concise and maintainable - just covering the essential setup that trips people up.
Would this kind of documentation addition be welcome? I'm happy to work on it if the maintainers think it would be useful.
I can start with a simple setup guide and see how that goes, or if you have specific areas you'd like me to focus on, I'm open to suggestions.