-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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]>
- Loading branch information
Showing
1 changed file
with
7 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()), []); |