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

NODE_V8_COVERAGE not output when Error thrown during initialization #29570

Closed
bcoe opened this issue Sep 15, 2019 · 2 comments
Closed

NODE_V8_COVERAGE not output when Error thrown during initialization #29570

bcoe opened this issue Sep 15, 2019 · 2 comments
Labels
coverage Issues and PRs related to native coverage support. inspector Issues and PRs related to the V8 inspector protocol

Comments

@bcoe
Copy link
Contributor

bcoe commented Sep 15, 2019

  • Version: 12.0.0 -> 12.9.1.
  • Platform: OSX
  • Subsystem: coverage/process

Sometime between node@v11.15.0 and node@12.0.0 , NODE_V8_COVERAGE seems to have stopped outputting if a script throws in the first tick, as an example:

throw Error('error');
if (true) {
  console.info('hello world');
} else {
  console.info('goodnight moon');
}

This script will output coverage:

process.exit(1);
if (true) {
  console.info('hello world');
} else {
  console.info('goodnight moon');
}

I've noticed, similarly, that prepareStackTrace appears to not be called, which is why I'm using timeouts in the tests here; I wonder if the root cause might be the same.

CC: @addaleax, @joyeecheung, @devsnek, @nodejs/testing

@bcoe bcoe added inspector Issues and PRs related to the V8 inspector protocol coverage Issues and PRs related to native coverage support. labels Sep 15, 2019
@bcoe bcoe changed the title NODE_V8_COVERAGE not output Error thrown during initialization NODE_V8_COVERAGE not output when Error thrown during initialization Sep 15, 2019
@bcoe
Copy link
Contributor Author

bcoe commented Sep 16, 2019

I debugged the prepareStackTrace, the problem is that the sourceMapCache I've been working on is keyed on the module, which does not get placed in the cache on a compile failure.

Have not dug into coverage, but unrelated issue it would seem.

@joyeecheung
Copy link
Member

We just need to output the profile during the uncaught exception routine. I'll send in a PR.

@bcoe bcoe closed this as completed in b263423 Sep 24, 2019
targos pushed a commit that referenced this issue Oct 1, 2019
So that coverage, .etc are properly written in case of a normal
fatal exception.

PR-URL: #29611
Fixes: #29570
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Ben Coe <bencoe@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
coverage Issues and PRs related to native coverage support. inspector Issues and PRs related to the V8 inspector protocol
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants