Vscode-js-debug: Possible to blackbox scripts coming from node_modules?

Created on 15 May 2020  Â·  15Comments  Â·  Source: microsoft/vscode-js-debug

I have long stack traces, I tried skipFiles without much luck.
Is there a glob that can be passed in to filter out libraries in node_modules like react etc?

I passed in “node_modules” but that didn’t work (I still get library files in the call stack), I will see if I can make reproducible steps

I tried following the advice of https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_skipping-uninteresting-code-node-chrome which says to use ${workspaceFolder}/node_modules/**/*.js

I was looking for documentation on how to properly do this but couldn’t find any so I opened https://github.com/microsoft/vscode-js-debug/issues/471

Version
v2020.5.1217

VSCode Version
Version: 1.46.0-insider (system setup)

Screenshot
Below you can see on the right I've set node_modules in skipFiles.
but on the call stack on the left i still have all of the express files.

skipFilesNotWorking

Same but with smartStep enabled
image

Steps to reproduce the above

bug verified

All 15 comments

@connor4312 i've updated the above with steps to reproduce and a screenshot

It looks like **/node_modules/**/* does give better results, is the documentation in https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_skipping-uninteresting-code-node-chrome wrong?

Thanks for the report, this was due to lack of normalization of paths on windows -- we use micromatch which only works with forward slashes, and the interpolated ${workspaceFolder} uses backslashes.

Hey @connor4312 I tried this on my Mac today, using node-pwa and it looks like it still doesn’t work :/

I had to use **/subfolder instead of ${workspaceFolder}/subfolder you want me to make a new issue?

I'll recycle this issue

I can't reproduce this at the moment, so will let you know if i see it again

actually, I think ${workspaceFolder}/subfolder never worked, it should be ${workspaceFolder}/subfolder/**.

The documentation specifies that they're glob patterns, so this is working as intended 🙂

@connor4312 its not that, both had /** on the end,
ill send you a video.

I think it has something to do with if you set cwd

huh, okay. I'll try to repro this morning. If you see it again please capture a trace: true log and share it. Thanks!

@connor4312 did you see my vid?
I can reproduce this whenever so i can also send the trace through too

I checked GH notifications before I checked email -- I saw the video. Looking into it.

I have a hypothesis about what's going on. Once you break, if you wait a few seconds and then step over, are the skipFiles correctly applied in the new stack?

I have a hypothesis about what's going on. Once you break, if you wait a few seconds and then step over, are the skipFiles correctly applied in the new stack?

Nope

Thanks for the emailed logs!

The problem was because the script skipping logic only used absolute paths for files on disk that were identical to ones Node loaded. Jest does some 'weird stuff' in general and this was case for a couple of your files (I actually see the same path getting loaded twice, we ignore the duplicate load but the second one might have been the real file). In f34d43e I changed our logic to use the hypothesized disk path for setting up script skipping, when present, whether or not the contents match. I think this is a better approach since this behavior would have caused the same inconsistencies when using things like ts-node or @babel/register.

cc @roblourens who wrote this code -- let me know if you see any problems with this.

If we go this change we can also make skipping initialization synchronous since we no longer do heavy work in this code path.

@connor4312 are there any unintended consequences of making the change in https://github.com/microsoft/vscode-js-debug/commit/f34d43e95d98169bbc5087ea17e4048d53f53bda ?

Was this page helpful?
0 / 5 - 0 ratings