You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run the script do-test from the gist. (It will install Jest locally, create a src directory that has the structure that I found to be problematic, and then run Jest on the test in that directory.)
Expected behavior
I expected to see the test run.
Actual behavior
The following output:
FAIL tests/Thing.test.js
● Test suite failed to run
Cannot find module '#x/Thing' from 'index.js'
at Resolver._throwModNotFoundError (../jest/node_modules/jest-resolve/build/resolver.js:487:11)
at async Promise.all (index 0)
at async Promise.all (index 0)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 0.17 s
Ran all test suites matching /Thing/i.
Additional context
I believe what's going on is that, somehow, when Jest loads (or causes to be loaded) an ESM module due to an import in a test file, the imports binding from the loaded module's package.json is being ignored. For reference, here's what's in it for this example:
(I don't think the #p binding is necessary for reproduction; I thought it might be handy to pre-emptively answer the question of what the bigger intention is with this arrangement.)
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
Version
29.0.3
Steps to reproduce
do-test
from the gist. (It will install Jest locally, create asrc
directory that has the structure that I found to be problematic, and then run Jest on the test in that directory.)Expected behavior
I expected to see the test run.
Actual behavior
The following output:
Additional context
I believe what's going on is that, somehow, when Jest loads (or causes to be loaded) an ESM module due to an
import
in a test file, theimports
binding from the loaded module'spackage.json
is being ignored. For reference, here's what's in it for this example:(I don't think the
#p
binding is necessary for reproduction; I thought it might be handy to pre-emptively answer the question of what the bigger intention is with this arrangement.)Environment
The text was updated successfully, but these errors were encountered: