mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
PR-URL: https://github.com/nodejs/node/pull/12735 Refs: https://github.com/nodejs/node/pull/12455 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const execFile = require('child_process').execFile;
|
|
const warnmod = require.resolve(`${common.fixturesDir}/warnings.js`);
|
|
const node = process.execPath;
|
|
|
|
const normal = [warnmod];
|
|
const noWarn = ['--no-warnings', warnmod];
|
|
const traceWarn = ['--trace-warnings', warnmod];
|
|
|
|
execFile(node, normal, function(er, stdout, stderr) {
|
|
// Show Process Warnings
|
|
assert.strictEqual(er, null);
|
|
assert.strictEqual(stdout, '');
|
|
assert(/^\(.+\)\sWarning: a bad practice warning/.test(stderr));
|
|
});
|
|
|
|
execFile(node, noWarn, function(er, stdout, stderr) {
|
|
// Hide Process Warnings
|
|
assert.strictEqual(er, null);
|
|
assert.strictEqual(stdout, '');
|
|
assert(!/^\(.+\)\sWarning: a bad practice warning/.test(stderr));
|
|
});
|
|
|
|
execFile(node, traceWarn, function(er, stdout, stderr) {
|
|
// Show Warning Trace
|
|
assert.strictEqual(er, null);
|
|
assert.strictEqual(stdout, '');
|
|
assert(/^\(.+\)\sWarning: a bad practice warning/.test(stderr));
|
|
assert(/at Object\.<anonymous>\s\(.+warnings\.js:3:9\)/.test(stderr));
|
|
});
|