Repository navigation
NODE_V8_COVERAGE does not fail gracefully when inspector is disabled #29542
Description
Activity
- addedinspectorIssues and PRs related to the V8 inspector protocol.Issues and PRs related to the V8 inspector protocol.coverageIssues and PRs related to Node.js code coverage support.Issues and PRs related to Node.js code coverage support.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.
on Sep 13, 2019 @addaleax I'd like to take a look at this. Up for the
mentor-availablething. 😄@shobhitchittora Cool! As you can see from the stack trace, the function that sets up coverage is
setupCoverageHooksinlib/internal/bootstrap/pre_execution.js, so that’s likely what you’d want to modify. There are also other examples of warnings being emitted in that file that you can take a look at.As for contributing in general, https://github.com/nodejs/node/blob/master/doc/guides/contributing/pull-requests.md and https://github.com/nodejs/node/blob/master/doc/guides/writing-tests.md are probably helpful starting points. And if you run any trouble, feel free to ping me here or on Twitter or IRC (or generally feel free to ask a question in #node-dev on Freenode).
Thanks @addaleax for the code pointers. It's been some time since I pushed code here ( maybe in 2018 ), hope the guidelines are still the same.
Well! I see the docs and guidelines are much better organized now. Great work there!
Reacted by Anna Henningsen@shobhitchittora What’s wrong is that the
profilerinternal binding from C++ isn’t available when the inspector is disabled – that’s what’s causing the exception in the output that I posted.One way (of multiple ones) to address this might be to watch out for such an exception in JS, and handle it appropriately rather than letting it crash the process.
Oh! Got it. I've added an try-catch block now and the output is as below -
>> NODE_V8_COVERAGE=/tmp/foo ./node -p 42 42 (node:12182) Warning: Profiler is not enabled.- added a commit that references this issue
on Sep 23, 2019 - added a commit that references this issue
on Sep 23, 2019 - added a commit that references this issue
on Sep 25, 2019 - added a commit that references this issue
on Jul 27, 2026
currently yields
I feel like this should a) print some kind of helpful message and b) maybe only print a warning or so instead of failing to execute the script.