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
I was able to clear this error by changing line 132 in dist/jest-environment.js to the following:
var import_jest_message_util = require("../../../node_modules/jest-message-util/build/index.js");
This causes it to go up two more directory levels before attempting to traverse node_modules/, which allows it to successfully find jest-message-util/build/index.js.
The text was updated successfully, but these errors were encountered:
For anyone looking for an automated workaround until this is fixed, you can fix this with sed.
First, add a script in your repo called fix-jest-environment-obsidian:
#!/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 package.json:
{
..."scripts": {
..."test": "sh fix-jest-environment-obsidian && jest --coverage",
"test:watch": "sh fix-jest-environment-obsidian && jest --coverage --watch"...
}
}
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: