Skip to content
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

vitest: Error thrown in vscode debugger Exception has occurred: TypeError: getPromiseDetails is not a function #7342

Closed
dmaskasky opened this issue Jan 23, 2025 · 5 comments

Comments

@dmaskasky
Copy link

Hello,

I am running into the error Exception has occurred: TypeError: getPromiseDetails is not a function when running the vscode debugger.

The error is thrown in node_modules/.pnpm/[email protected]/node_modules/loupe/lib/promise.js.
However, it works when I run pnpm ./node_modules/vitest/vitest.mjs.

launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Debug Vitest",
      "skipFiles": ["<node_internals>/**"],
      "program": "${workspaceFolder}/node_modules/vitest/vitest.mjs",
      "args": ["tests/main.test.tsx"],
      "cwd": "${workspaceFolder}",
      "outFiles": ["${workspaceFolder}/**/*.js"]
    }
  ]
}

vitest version: [email protected]
vscode version:

Version: 1.96.4 (Universal)
Commit: cd4ee3b1c348a13bafd8f9ad8060705f6d4b9cba
Date: 2025-01-16T00:16:19.038Z (1 wk ago)
Electron: 32.2.6
ElectronBuildId: 10629634
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Darwin arm64 24.2.0
vitest 2.1.8
├─┬ @vitest/expect 2.1.8
│ ├─┬ @vitest/utils 2.1.8
│ │ └── loupe 3.1.2
│ └─┬ chai 5.1.2
│   └── loupe 3.1.2
├─┬ @vitest/runner 2.1.8
│ └─┬ @vitest/utils 2.1.8
│   └── loupe 3.1.2
├─┬ @vitest/utils 2.1.8
│ └── loupe 3.1.2
└─┬ chai 5.1.2
  └── loupe 3.1.2

call stack

ModuleJob.run (node:internal/modules/esm/module_job:234:25)
async ModuleLoader.import (node:internal/modules/esm/loader:473:24)
async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)

I think the issue is loupe is trying to access getPromiseDetails, an internal function that was officially removed in node 16. Currently, process.binding('util') only gives the following:
['isExternal', 'isDate', 'isNativeError', 'isRegExp', 'isAsyncFunction', 'isPromise', 'isMap', 'isSet', 'isMapIterator', 'isSetIterator', 'isArrayBuffer', 'isDataView', 'isAnyArrayBuffer', 'isArrayBufferView', 'isTypedArray', 'isUint8Array']

A few questions I have,

  1. what am I doing wrong that this suddenly stops working for me (running the vscode debugger)
  2. why does loupe rely on an api that is not available on node 20?

Any insights is greatly appreciated.

@hi-ogawa
Copy link
Contributor

what am I doing wrong that this suddenly stops working for me (running the vscode debugger)

Do you mean vscode debugger has been working but it's broken after upgrading something? Either way, we need a repro to investigate this though.

Copy link

Hello @dmaskasky. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with needs reproduction will be closed if they have no activity within 3 days.

@dmaskasky
Copy link
Author

what am I doing wrong that this suddenly stops working for me (running the vscode debugger)

Do you mean vscode debugger has been working but it's broken after upgrading something? Either way, we need a repro to investigate this though.

Yes, this is exactly what happened. I upgraded node, pnpm, vitest, and other libraries. Then I reverted everything, but now my vscode debugger doesn't work for any of my workspaces.

@hi-ogawa
Copy link
Contributor

Is it possible you have "Breakpoints > Caught Exceptions" enabled? https://code.visualstudio.com/docs/editor/debugging#_advanced-breakpoint-topics This would probably surface all errors in the debugger and it might do confusing things.

@dmaskasky
Copy link
Author

Yes, I just realized.

Image

Well, that was a fun way to spend 2.5 hours. 😅

Anyways, thank you for the prompt reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants