Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ashvin2005
Copy link

Add documentation for using Mocha with TypeScript to help developers avoid common setup issues.

  • Add TypeScript configuration examples
  • Include basic test examples
  • Cover common troubleshooting issues
  • Add package.json and tsconfig.json templates

This addresses frequent questions about TypeScript setup that come up in issues and community discussions.


PR Checklist


Overview

This PR introduces a new “TypeScript Setup” section in Mocha’s documentation that provides a step-by-step guide for integrating Mocha with TypeScript.

The new content includes:

  • Example configurations for tsconfig.json, .mocharc.json, and test scripts
  • Sample TypeScript test files demonstrating setup and execution
  • A troubleshooting section covering common TypeScript-related issues (e.g., “Cannot find module”, missing type definitions, and ts-node configuration)

This documentation aims to make it easier for developers—especially newcomers—to quickly get Mocha running in TypeScript projects without encountering common configuration pitfalls.

Add documentation for using Mocha with TypeScript to help developers
avoid common setup issues.

- Add TypeScript configuration examples
- Include basic test examples
- Cover common troubleshooting issues
- Add package.json and tsconfig.json templates

This addresses frequent questions about TypeScript setup that come up
in issues and community discussions.
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 11, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@mark-wiemer
Copy link
Member

At the highest level, we'll want these docs to be present in both the current site and the new site (https://mochajs.org/next), you can refer to the PRs around #5248 for reference

@JoshuaKGoldberg
Copy link
Member

👋 Just checking in @ashvin2005, is this still something you have time for?

@ashvin2005
Copy link
Author

Hi, @mark-wiemer , I've added the TypeScript documentation to both the current docs site and the new docs-next site as requested. The docs are now available in:

  • docs/typescript.md (current site)
  • docs-next/src/content/docs/explainers/typescript.mdx (new site)

Both contain the same content but formatted appropriately for each documentation system.

@mark-wiemer
Copy link
Member

Thanks @ashvin2005 , is this still a draft PR or is it ready for review?

@codecov
Copy link

codecov bot commented Dec 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.52%. Comparing base (9cc3ada) to head (3e97382).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5530   +/-   ##
=======================================
  Coverage   93.52%   93.52%           
=======================================
  Files          57       57           
  Lines        4465     4465           
  Branches      918      918           
=======================================
  Hits         4176     4176           
  Misses        289      289           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JoshuaKGoldberg
Copy link
Member

Just a heads up, I don't think ready for re-review as #5529 (comment) has not been addressed.

@ashvin2005 ashvin2005 marked this pull request as ready for review December 21, 2025 19:01
@ashvin2005
Copy link
Author

ashvin2005 commented Dec 21, 2025

Hi @JoshuaKGoldberg @mark-wiemer,

I've updated the docs based on your feedback.

@mark-wiemer
Copy link
Member

@ashvin2005 please review past PRs by "TG199" where we migrated wiki content, we need to make sure we update the navigation as well

@mark-wiemer mark-wiemer self-assigned this Dec 31, 2025
@mark-wiemer mark-wiemer added the status: waiting for author waiting on response from OP or other posters - more information needed label Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting for author waiting on response from OP or other posters - more information needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve TypeScript setup documentation

3 participants