Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions 3 src/node_errors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,9 @@ void TriggerUncaughtException(Isolate* isolate,

// Now we are certain that the exception is fatal.
ReportFatalException(env, error, message, EnhanceFatalException::kEnhance);
#if HAVE_INSPECTOR
profiler::EndStartedProfilers(env);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh just realized we should call profiler::EndStartedProfilers instead since the whole WaitForInspectorDisconnect resets signals.

#endif

// If the global uncaught exception handler sets process.exitCode,
// exit with that code. Otherwise, exit with 1.
Expand Down
7 changes: 7 additions & 0 deletions 7 test/fixtures/v8-coverage/throw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const a = 99;
if (true) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no point of adding else block

Copy link
Member Author

@joyeecheung joyeecheung Sep 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in the test though?

const b = 101;
} else {
const c = 102;
}
throw new Error('test');
18 changes: 18 additions & 0 deletions 18 test/parallel/test-v8-coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,24 @@ function nextdir() {
assert.strictEqual(fixtureCoverage.functions[0].ranges[1].count, 0);
}

// Outputs coverage when error is thrown in first tick.
{
const coverageDirectory = path.join(tmpdir.path, nextdir());
const output = spawnSync(process.execPath, [
require.resolve('../fixtures/v8-coverage/throw')
], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } });
if (output.status !== 1) {
console.log(output.stderr.toString());
}
assert.strictEqual(output.status, 1);
const fixtureCoverage = getFixtureCoverage('throw.js', coverageDirectory);
assert.ok(fixtureCoverage, 'coverage not found for file');
// First branch executed.
assert.strictEqual(fixtureCoverage.functions[0].ranges[0].count, 1);
// Second branch did not execute.
assert.strictEqual(fixtureCoverage.functions[0].ranges[1].count, 0);
}

// Outputs coverage when process.exit(1) exits process.
{
const coverageDirectory = path.join(tmpdir.path, nextdir());
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.