-
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.
- Loading branch information
Ethan Arrowood
committed
Nov 10, 2023
1 parent
609cd7f
commit a6baf63
Showing
5 changed files
with
90 additions
and
0 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
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
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
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict'; | ||
|
||
const sys = require('sys'); | ||
const assert = require('assert'); | ||
const vm = require('vm'); | ||
|
||
try { | ||
assert.fail('a', 'b'); | ||
} catch (e) {} | ||
|
||
vm.measureMemory(); |
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
const fixtures = require('../common/fixtures'); | ||
const assert = require('assert'); | ||
const execFile = require('child_process').execFile; | ||
const warnmod = require.resolve(fixtures.path('disable-warnings.js')); | ||
const node = process.execPath; | ||
|
||
const dep0025Message = /\(node:\d+\) \[DEP0025\] DeprecationWarning: sys is deprecated\. Use util instead\./; | ||
const dep0094Message = /\(node:\d+\) \[DEP0094\] DeprecationWarning: assert\.fail\(\) with more than one argument is deprecated\. Please use assert\.strictEqual\(\) instead or only pass a message\./; | ||
const experimentalWarningMessage = /\(node:\d+\) ExperimentalWarning: vm\.measureMemory is an experimental feature and might change at any time/; | ||
|
||
// Show All Warnings | ||
execFile(node, [warnmod], function(er, stdout, stderr) { | ||
assert.strictEqual(er, null); | ||
assert.strictEqual(stdout, ''); | ||
assert.match(stderr, dep0025Message); | ||
assert.match(stderr, dep0094Message); | ||
assert.match(stderr, experimentalWarningMessage); | ||
}); | ||
|
||
// Hide All Warnings | ||
execFile(node, ['--no-warnings', warnmod], function(er, stdout, stderr) { | ||
assert.strictEqual(er, null); | ||
assert.strictEqual(stdout, ''); | ||
assert.doesNotMatch(stderr, dep0025Message); | ||
assert.doesNotMatch(stderr, dep0094Message); | ||
assert.doesNotMatch(stderr, experimentalWarningMessage); | ||
}); | ||
|
||
// Hide Only DEP0025 Warnings | ||
execFile(node, ['--disable-warnings=DEP0025', warnmod], function(er, stdout, stderr) { | ||
assert.strictEqual(er, null); | ||
assert.strictEqual(stdout, ''); | ||
assert.doesNotMatch(stderr, dep0025Message); | ||
assert.match(stderr, dep0094Message); | ||
assert.match(stderr, experimentalWarningMessage); | ||
}); | ||
|
||
// Hide DEP0025 and DEP0094 Warnings | ||
execFile(node, ['--disable-warnings=DEP0025', '--disable-warnings=DEP0094', warnmod], function(er, stdout, stderr) { | ||
assert.strictEqual(er, null); | ||
assert.strictEqual(stdout, ''); | ||
assert.doesNotMatch(stderr, dep0025Message); | ||
assert.doesNotMatch(stderr, dep0094Message); | ||
assert.match(stderr, experimentalWarningMessage); | ||
}); | ||
|
||
// Hide DeprecationWarnings | ||
execFile(node, ['--disable-warnings=DeprecationWarning', warnmod], function(er, stdout, stderr) { | ||
assert.strictEqual(er, null); | ||
assert.strictEqual(stdout, ''); | ||
assert.doesNotMatch(stderr, dep0025Message); | ||
assert.doesNotMatch(stderr, dep0094Message); | ||
assert.match(stderr, experimentalWarningMessage); | ||
}); | ||
|
||
execFile(node, ['--disable-warnings=ExperimentalWarning', warnmod], function(er, stdout, stderr) { | ||
assert.strictEqual(er, null); | ||
assert.strictEqual(stdout, ''); | ||
assert.match(stderr, dep0025Message); | ||
assert.match(stderr, dep0094Message); | ||
assert.doesNotMatch(stderr, experimentalWarningMessage); | ||
}); |