Skip to content

Commit a1fcde0

Browse files
cjihrigrvagg
authored andcommitted
test: simplify test-api-getreport.js
PR-URL: #26169 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Weijia Wang <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent bd40a12 commit a1fcde0

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed
+7-20
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,12 @@
1+
// Flags: --experimental-report
12
'use strict';
2-
3-
// Testcase for returning report as a string via API call
43
const common = require('../common');
54
common.skipIfReportDisabled();
65
const assert = require('assert');
7-
if (process.argv[2] === 'child') {
8-
console.log(process.report.getReport());
9-
} else {
10-
const helper = require('../common/report.js');
11-
const spawnSync = require('child_process').spawnSync;
12-
const tmpdir = require('../common/tmpdir');
13-
tmpdir.refresh();
6+
const helper = require('../common/report');
147

15-
const args = ['--experimental-report', __filename, 'child'];
16-
const child = spawnSync(process.execPath, args, { cwd: tmpdir.path });
17-
const report_msg = 'Found report files';
18-
const std_msg = 'Found messages on stderr';
19-
assert.ok(child.stderr.toString().includes(
20-
`(node:${child.pid}) ExperimentalWarning: report is an` +
21-
' experimental feature. This feature could change at any time'), std_msg);
22-
const reportFiles = helper.findReports(child.pid, tmpdir.path);
23-
assert.deepStrictEqual(reportFiles, [], report_msg);
24-
helper.validateContent(child.stdout);
25-
}
8+
common.expectWarning('ExperimentalWarning',
9+
'report is an experimental feature. This feature could ' +
10+
'change at any time');
11+
helper.validateContent(process.report.getReport());
12+
assert.deepStrictEqual(helper.findReports(process.pid, process.cwd()), []);

0 commit comments

Comments
 (0)