-
Notifications
You must be signed in to change notification settings - Fork 138
Closed
Labels
Description
π Description
Running tests from the code lens works just fine with enableESM set to true. The problem we're running into is when we try to debug tests from code lens it's attempting to access jest from the project's node_modules, but jest is installed in the workspace root, so it cannot be found.
π₯οΈ Environment
| Item | Value |
|---|---|
| Operating System | macOS 26.2 |
| Shell | zsh |
| Project Framework | Nx, NestJS |
| Test Framework | Jest |
| Jest/Vitest Config Name | jest.config.ts |
| Project Type | Monorepo |
| IDE | VSCode |
| VSCode Version | 1.108.2 |
| Extension Version | 0.4.111 |
| Last Working Version | They've changed a bunch recently, hard to tell |
π§ Debug Logging
N/A
π Project Structure
βββ node_modules
βββ package.json
βββ jest.config.js (generated by nx)
βββ packages/
β βββ my-project/
β βββ node_modules
β βββ package.json (contains workspace references)
β βββ jest.config.ts
β βββ my-thing.ts
β βββ my-thing.spec.ts
βοΈ Jest/Vitest Configuration
N/A
π οΈ Extension Settings
"jestrunner.enableESM": trueπ Steps to Reproduce
Please provide detailed steps to reproduce the issue:
- Open test file
- Click "Debug" code lens option
β Expected Behavior
Able to debug test. Should use jest installed in the root node_modules.
β Actual Behavior
An error instead
π Test Command Output
Console/Terminal Output:
cd /Users/me/Source/my-workspace/packages/my-project ;
/usr/bin/env \
'NODE_OPTIONS= --require "/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/bootloader.js" --inspect-publish-uid=http' 'VSCODE_INSPECTOR_OPTIONS=:::{"inspectorIpc":"/var/folders/tn/ygcv2bxj0h1fn6z77fs977t80000gp/T/node-cdp.72583-b87cb9d7-81.sock","deferredMode":false,"waitForDebugger":"","execPath":"/opt/homebrew/opt/nvm/versions/node/v22.11.0/bin/node","onlyEntrypoint":false,"autoAttachMode":"always","fileCallback":"/var/folders/tn/ygcv2bxj0h1fn6z77fs977t80000gp/T/node-debug-callback-d9073989cec9bbe8"}' \
/opt/homebrew/opt/nvm/versions/node/v22.11.0/bin/node \
--experimental-vm-modules \
./node_modules/jest/bin/jest.js \
--runInBand \
/Users/me/Source/my-workspace/packages/my-project/my-thing\\.spec\\.ts \
-c \
/Users/me/Source/my-workspace/packages/my-project/jest.config.ts \
-t \
MyThing\ should\ do\ the\ thingDebugger attached.
Waiting for the debugger to disconnect...
node:internal/modules/cjs/loader:1252
throw err;
^
Error: Cannot find module '/Users/me/Source/my-workspace/packages/my-project/node_modules/jest/bin/jest.js'
at Function._resolveFilename (node:internal/modules/cjs/loader:1249:15)
at Function._load (node:internal/modules/cjs/loader:1075:27)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:170:5)
at node:internal/main/run_main_module:36:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v22.11.0jlamb6 and upete