|
| 1 | +// Flags: --experimental-report |
1 | 2 | 'use strict';
|
2 |
| - |
3 |
| -// Testcase for returning report as a string via API call |
4 | 3 | const common = require('../common');
|
5 | 4 | common.skipIfReportDisabled();
|
6 | 5 | 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'); |
14 | 7 |
|
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