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: 1 addition & 2 deletions 3 src/node_report.cc
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ static void PrintJavaScriptStack(JSONWriter* writer,
int line = ss.find('\n');
if (line == -1) {
writer->json_keyvalue("message", ss);
writer->json_objectend();
} else {
std::string l = ss.substr(0, line);
writer->json_keyvalue("message", l);
Expand All @@ -382,8 +381,8 @@ static void PrintJavaScriptStack(JSONWriter* writer,
ss = ss.substr(line + 1);
line = ss.find('\n');
}
writer->json_arrayend();
}
writer->json_arrayend();
writer->json_objectend();
}

Expand Down
8 changes: 8 additions & 0 deletions 8 test/report/test-report-getreport.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ common.expectWarning('ExperimentalWarning',
assert.deepStrictEqual(helper.findReports(process.pid, process.cwd()), []);
}

{
// Test with an error with one line stack
const error = new Error();
error.stack = 'only one line';
helper.validateContent(process.report.getReport(error));
assert.deepStrictEqual(helper.findReports(process.pid, process.cwd()), []);
}

// Test with an invalid error argument.
[null, 1, Symbol(), function() {}, 'foo'].forEach((error) => {
common.expectsError(() => {
Expand Down
8 changes: 8 additions & 0 deletions 8 test/report/test-report-writereport.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ function validate() {
validate();
}

{
// Test with an error with one line stack
const error = new Error();
error.stack = 'only one line';
process.report.writeReport(error);
himself65 marked this conversation as resolved.
Outdated
Show resolved Hide resolved
validate();
}

{
// Test with a file argument.
const file = process.report.writeReport('custom-name-1.json');
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.