-
Notifications
You must be signed in to change notification settings - Fork 52
Closed
Description
It seems that when using import-in-the-middle with mocha, mocha exits without running tests as require.main === module evaluates to false when it's trying to determine if it is run directly from Node.js.
Expected Behavior
mocha runs tests even if IITM is used
Actual Behavior
mocha exists with 0, not running any tests
Steps to Reproduce the Problem
I've created a reproducer to illustrate that contains a more detailed description:
https://github.com/pichlermarc/esm-test
It contains two scripts, both attempt to run a single test that always fails, one with the IITM loader, and one without.
git clone https://github.com/pichlermarc/esm-testnpm installnpm run test
- this does not use the IITM hook, tests do run, and mocha exits with1(as expected)npm run test:iitm
- this uses the IITM hook, tests do not run, andmochaexits with0(1is expected)
Specifications
- Version:
import-in-the-middle@1.4.2mocha@10.2.0- Node.js v18.18.1
- Platform: Ubuntu 22.04
- Subsystem:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels