Skip to content
Permalink
Browse files

test: simplify test-api-getreport.js

PR-URL: #26169
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information...
cjihrig authored and rvagg committed Feb 17, 2019
1 parent bd40a12 commit a1fcde035e5f851214cdf15c1abec7f0739c7581
Showing with 7 additions and 20 deletions.
  1. +7 −20 test/node-report/test-api-getreport.js
@@ -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()), []);

0 comments on commit a1fcde0

Please sign in to comment.
You can’t perform that action at this time.