diff options
author | cjihrig <cjihrig@gmail.com> | 2019-02-20 11:10:18 -0500 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2019-02-22 13:42:02 -0500 |
commit | fac40db36ea125f1522213eec715b32143af6489 (patch) | |
tree | 97e0d7e689c0e083475a28cba3104cdab5315520 /test | |
parent | a1d05e49fee4881150c6f62bf19706f4ca75edf6 (diff) | |
download | android-node-v8-fac40db36ea125f1522213eec715b32143af6489.tar.gz android-node-v8-fac40db36ea125f1522213eec715b32143af6489.tar.bz2 android-node-v8-fac40db36ea125f1522213eec715b32143af6489.zip |
test: simplify test-api-nohooks.js
PR-URL: https://github.com/nodejs/node/pull/26217
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/node-report/test-api-nohooks.js | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/test/node-report/test-api-nohooks.js b/test/node-report/test-api-nohooks.js index 67d843c270..478586fe8d 100644 --- a/test/node-report/test-api-nohooks.js +++ b/test/node-report/test-api-nohooks.js @@ -1,28 +1,19 @@ +// Flags: --experimental-report 'use strict'; -// Testcase to produce report via API call, using the no-hooks/no-signal -// interface - i.e. require('node-report/api') +// Test producing a report via API call, using the no-hooks/no-signal interface. const common = require('../common'); common.skipIfReportDisabled(); -if (process.argv[2] === 'child') { - process.report.triggerReport(); -} else { - const helper = require('../common/report.js'); - const spawn = require('child_process').spawn; - const assert = require('assert'); - const tmpdir = require('../common/tmpdir'); - tmpdir.refresh(); +const assert = require('assert'); +const helper = require('../common/report'); +const tmpdir = require('../common/tmpdir'); - const child = spawn(process.execPath, ['--experimental-report', - __filename, 'child'], - { cwd: tmpdir.path }); - child.on('exit', common.mustCall((code) => { - const report_msg = 'No reports found'; - const process_msg = 'Process exited unexpectedly'; - assert.strictEqual(code, 0, process_msg + ':' + code); - const reports = helper.findReports(child.pid, tmpdir.path); - assert.strictEqual(reports.length, 1, report_msg); - const report = reports[0]; - helper.validate(report); - })); -} +common.expectWarning('ExperimentalWarning', + 'report is an experimental feature. This feature could ' + + 'change at any time'); +tmpdir.refresh(); +process.report.setOptions({ path: tmpdir.path }); +process.report.triggerReport(); +const reports = helper.findReports(process.pid, tmpdir.path); +assert.strictEqual(reports.length, 1); +helper.validate(reports[0]); |