| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent dbbceda commit bc11415
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,28 +1,19 @@ | |||
| 1 | + // Flags: --experimental-report | ||
| 1 | 2 | 'use strict'; | |
| 2 | 3 | ||
| 3 | - // Testcase to produce report via API call, using the no-hooks/no-signal | ||
| 4 | - // interface - i.e. require('node-report/api') | ||
| 4 | + // Test producing a report via API call, using the no-hooks/no-signal interface. | ||
| 5 | 5 | const common = require('../common'); | |
| 6 | 6 | common.skipIfReportDisabled(); | |
| 7 | - if (process.argv[2] === 'child') { | ||
| 8 | - process.report.triggerReport(); | ||
| 9 | - } else { | ||
| 10 | - const helper = require('../common/report.js'); | ||
| 11 | - const spawn = require('child_process').spawn; | ||
| 12 | - const assert = require('assert'); | ||
| 13 | - const tmpdir = require('../common/tmpdir'); | ||
| 14 | - tmpdir.refresh(); | ||
| 7 | + const assert = require('assert'); | ||
| 8 | + const helper = require('../common/report'); | ||
| 9 | + const tmpdir = require('../common/tmpdir'); | ||
| 15 | 10 | ||
| 16 | - const child = spawn(process.execPath, ['--experimental-report', | ||
| 17 | - __filename, 'child'], | ||
| 18 | - { cwd: tmpdir.path }); | ||
| 19 | - child.on('exit', common.mustCall((code) => { | ||
| 20 | - const report_msg = 'No reports found'; | ||
| 21 | - const process_msg = 'Process exited unexpectedly'; | ||
| 22 | - assert.strictEqual(code, 0, process_msg + ':' + code); | ||
| 23 | - const reports = helper.findReports(child.pid, tmpdir.path); | ||
| 24 | - assert.strictEqual(reports.length, 1, report_msg); | ||
| 25 | - const report = reports[0]; | ||
| 26 | - helper.validate(report); | ||
| 27 | - })); | ||
| 28 | - } | ||
| 11 | + common.expectWarning('ExperimentalWarning', | ||
| 12 | + 'report is an experimental feature. This feature could ' + | ||
| 13 | + 'change at any time'); | ||
| 14 | + tmpdir.refresh(); | ||
| 15 | + process.report.setOptions({ path: tmpdir.path }); | ||
| 16 | + process.report.triggerReport(); | ||
| 17 | + const reports = helper.findReports(process.pid, tmpdir.path); | ||
| 18 | + assert.strictEqual(reports.length, 1); | ||
| 19 | + helper.validate(reports[0]); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments