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

Skip to content

Conversation

@sam-super
Copy link
Contributor

PR Checklist

Overview

Prevents "Cannot find module" when there are TS errors by prevent fallback to 'import()' when it errors.

The downside is this is tightly coupled to how ts-node throws errors when loading modules. However, this change seems unlikely to have any unexpected side-effects, so the risk is that it wont help if someone is using a different TS loader, but it's still a net gain for most.

Prevents "Cannot find module" when there are TS errors
@codecov
Copy link

codecov bot commented Dec 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.53%. Comparing base (e1cf23c) to head (79dbe23).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5572   +/-   ##
=======================================
  Coverage   93.52%   93.53%           
=======================================
  Files          57       57           
  Lines        4465     4467    +2     
  Branches      918      919    +1     
=======================================
+ Hits         4176     4178    +2     
  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.

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

I agree with the strategy, but would really like a spot check from another maintainer to make sure there's no way we can get around it.

Just requesting changes on moving the debug() line.

Thanks!

@JoshuaKGoldberg JoshuaKGoldberg added the status: waiting for author waiting on response from OP or other posters - more information needed label Dec 18, 2025
sam-super and others added 3 commits December 19, 2025 07:53
…-mod-not-found

* 'ts-mod-not-found' of github.com:sam-super/mocha:
  feat: add mocha.mjs export (mochajs#5527)
  docs: bumped docs-next Astro to ^5.16.6 (mochajs#5574)
  build(dev-deps): upgrade `markdownlint-cli` to latest v0.46.0  (mochajs#5560)
@mark-wiemer mark-wiemer removed the status: waiting for author waiting on response from OP or other posters - more information needed label Dec 19, 2025
@mark-wiemer mark-wiemer self-requested a review December 19, 2025 08:08
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.

🐛 Bug: "Cannot find module" if module contains ts-node style 'TSError'

3 participants