-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Description
🚀 Feature Proposal
Allow calls to import such that they aren't routed through jest's implementation. Maybe provide an unmocked alias such as unmockedImport("./mymodule.js").
Motivation
The motivation is to be able to have tests of the package.json exports field within libraries and prevent exports in node environments from breaking.
An example where this would be useful is in this PR which I abandoned momentarily due to this missing feature.
Example
No response
Pitch
Sorry for spamming on issue #9771
You suggested that one solution would be to have a separate, regular node script to achieve this kind of test, which is something that I had actually considered myself when I was putting together the PR, but I didn't pursue this approach for a number of reasons:
- Work on a new version of
jestis underway and maybe this would be supported in the new version - I couldn't come up with a way to invoke this test file other than calling
exec("node ./mytest.js")from within the scripts file or modifying thepackage.jsontestscript to read something like"test": "jest && node ./my-separate-test.js". - It seems to me like an escape hatch should be available to be able to make regular import calls in case the
jestimplementation is not desirable.
Ultimately I was just wondering if this is a won't fix kind of feature, or something you are planning to add?
Thank you for all your hard work on this module!