Programming Languages
Bug Report
jest.mock silently ignored after switching a Node.js project to native ESM
After we set "type": "module" in package.json, jest.mock stopped replacing our mailer and tests started calling the real SMTP client. Static ESM imports are linked before any mock runs. Here is the mechanism and the fix with unstable_mockModule.