Skip to content

Commit a1fcde0

Browse files
cjihrigrvagg
authored andcommitted
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>
1 parent bd40a12 commit a1fcde0

1 file changed

Lines changed: 7 additions & 20 deletions

File tree

Lines changed: 7 additions & 20 deletions
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
constcommon=require('../common');
54
common.skipIfReportDisabled();
65
constassert=require('assert');
7-
if(process.argv[2]==='child'){
8-
console.log(process.report.getReport());
9-
}else{
10-
consthelper=require('../common/report.js');
11-
constspawnSync=require('child_process').spawnSync;
12-
consttmpdir=require('../common/tmpdir');
13-
tmpdir.refresh();
6+
consthelper=require('../common/report');
147

15-
constargs=['--experimental-report',__filename,'child'];
16-
constchild=spawnSync(process.execPath,args,{cwd: tmpdir.path});
17-
constreport_msg='Found report files';
18-
conststd_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-
constreportFiles=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)