forked from eth-p/jest-environment-obsidian
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Other]: Cannot find module '../node_modules/jest-message-util/build/index.js' #3
Comments
For anyone looking for an automated workaround until this is fixed, you can fix this with First, add a script in your repo called #!/bin/sh
# workaround for https://github.com/obsidian-community/jest-environment-obsidian/issues/3
sed -i 's/require("..\/node_modules\/jest-message-util\//require("..\/..\/..\/node_modules\/jest-message-util\//' ./node_modules/jest-environment-obsidian/dist/jest-environment.js Then in {
...
"scripts": {
...
"test": "sh fix-jest-environment-obsidian && jest --coverage",
"test:watch": "sh fix-jest-environment-obsidian && jest --coverage --watch"
...
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Affected Version
0.0.1
Info
The issue appears to be due to the way that the path to
node_modules/jest-message-util/build/index.js
is constructed insrc/warning.ts
.Description
After successfully implementing workaround for #2, when attempting to run a test via
npm run test
, I received the following error:(path to project root truncated for readability)
Environment
OS: Windows 10
Node: 18.16.1
Jest: 29.6.1
Steps to Reproduce
jest-environment-obsidian
vianpm install --save-dev jest-environment-obsidian
preset
injest.config.cjs
to'jest-environment-obsidian'
jest-preset.js
workaround from issue [Other]: Module jest-environment-obsidian should have "jest-preset.js" or "jest-preset.json" file at the root. #2npm run test
Workaround
I was able to clear this error by changing line 132 in
dist/jest-environment.js
to the following:This causes it to go up two more directory levels before attempting to traverse
node_modules/
, which allows it to successfully findjest-message-util/build/index.js
.The text was updated successfully, but these errors were encountered: