Skip to content
Merged
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
6 changes: 2 additions & 4 deletions src/node_report.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,7 @@ std::string TriggerNodeReport(Isolate* isolate,
return "";
}
outstream = &outfile;

std::cerr << std::endl
<< "Writing Node.js report to file: " << filename << std::endl;
std::cerr << std::endl << "Writing Node.js report to file: " << filename;
}

WriteNodeReport(isolate, env, message, trigger, filename, *outstream,
Expand All @@ -184,7 +182,7 @@ std::string TriggerNodeReport(Isolate* isolate,
outfile.close();
}

std::cerr << "Node.js report completed" << std::endl;
std::cerr << std::endl << "Node.js report completed" << std::endl;
return filename;
}

Expand Down
25 changes: 25 additions & 0 deletions test/report/test-report-triggerreport.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
const common = require('../common');
common.skipIfReportDisabled();
const assert = require('assert');
const { spawnSync } = require('child_process');
const fs = require('fs');
const path = require('path');
const helper = require('../common/report');
Expand Down Expand Up @@ -81,3 +82,27 @@ function validate() {
process.report.triggerReport('file', error);
}, { code: 'ERR_INVALID_ARG_TYPE' });
});

{
// Test the special "stdout" filename.
const args = ['--experimental-report', '-e',
'process.report.triggerReport("stdout")'];
const child = spawnSync(process.execPath, args, { cwd: tmpdir.path });
assert.strictEqual(child.status, 0);
assert.strictEqual(child.signal, null);
assert.strictEqual(helper.findReports(child.pid, tmpdir.path).length, 0);
helper.validateContent(child.stdout.toString());
}

{
// Test the special "stderr" filename.
const args = ['--experimental-report', '-e',
'process.report.triggerReport("stderr")'];
const child = spawnSync(process.execPath, args, { cwd: tmpdir.path });
assert.strictEqual(child.status, 0);
assert.strictEqual(child.signal, null);
assert.strictEqual(child.stdout.toString().trim(), '');
assert.strictEqual(helper.findReports(child.pid, tmpdir.path).length, 0);
const report = child.stderr.toString().split('Node.js report completed')[0];
helper.validateContent(report);
}