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

test: simplify test-api-getreport.js #26169

Merged
merged 1 commit into from
Feb 20, 2019
Merged
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
27 changes: 7 additions & 20 deletions test/node-report/test-api-getreport.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
// Flags: --experimental-report
'use strict';

// Testcase for returning report as a string via API call
const common = require('../common');
common.skipIfReportDisabled();
const assert = require('assert');
if (process.argv[2] === 'child') {
console.log(process.report.getReport());
} else {
const helper = require('../common/report.js');
const spawnSync = require('child_process').spawnSync;
const tmpdir = require('../common/tmpdir');
tmpdir.refresh();
const helper = require('../common/report');

const args = ['--experimental-report', __filename, 'child'];
const child = spawnSync(process.execPath, args, { cwd: tmpdir.path });
const report_msg = 'Found report files';
const std_msg = 'Found messages on stderr';
assert.ok(child.stderr.toString().includes(
`(node:${child.pid}) ExperimentalWarning: report is an` +
' experimental feature. This feature could change at any time'), std_msg);
const reportFiles = helper.findReports(child.pid, tmpdir.path);
assert.deepStrictEqual(reportFiles, [], report_msg);
helper.validateContent(child.stdout);
}
common.expectWarning('ExperimentalWarning',
'report is an experimental feature. This feature could ' +
'change at any time');
helper.validateContent(process.report.getReport());
assert.deepStrictEqual(helper.findReports(process.pid, process.cwd()), []);