summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/common/README.md10
-rw-r--r--test/common/index.js39
-rw-r--r--test/parallel/test-assert-fail-deprecation.js3
-rw-r--r--test/parallel/test-buffer-pending-deprecation.js2
-rw-r--r--test/parallel/test-child-process-custom-fds.js2
-rw-r--r--test/parallel/test-crypto-authenticated.js11
-rw-r--r--test/parallel/test-crypto-cipher-decipher.js3
-rw-r--r--test/parallel/test-crypto-deprecated.js10
-rw-r--r--test/parallel/test-fs-filehandle.js3
-rw-r--r--test/parallel/test-fs-truncate-fd.js2
-rw-r--r--test/parallel/test-fs-truncate.js4
-rw-r--r--test/parallel/test-net-server-connections.js2
-rw-r--r--test/parallel/test-performance-warning.js6
-rw-r--r--test/parallel/test-process-assert.js3
-rw-r--r--test/parallel/test-process-emit-warning-from-native.js3
-rw-r--r--test/parallel/test-process-env-deprecation.js3
-rw-r--r--test/parallel/test-promises-unhandled-proxy-rejections.js8
-rw-r--r--test/parallel/test-promises-unhandled-symbol-rejections.js10
-rw-r--r--test/parallel/test-repl-deprecations.js2
-rw-r--r--test/parallel/test-repl-memory-deprecation.js2
-rw-r--r--test/parallel/test-repl-turn-off-editor-mode.js2
-rw-r--r--test/parallel/test-require-deps-deprecation.js4
-rw-r--r--test/parallel/test-tls-dhe.js3
-rw-r--r--test/parallel/test-tls-ecdh-disable.js3
-rw-r--r--test/parallel/test-tls-legacy-deprecated.js3
-rw-r--r--test/parallel/test-tls-parse-cert-string.js3
-rw-r--r--test/parallel/test-util-inspect-deprecated.js3
-rw-r--r--test/parallel/test-util.js8
-rw-r--r--test/parallel/test-warn-sigprof.js3
29 files changed, 101 insertions, 59 deletions
diff --git a/test/common/README.md b/test/common/README.md
index 24468bdfd7..765ebe0123 100644
--- a/test/common/README.md
+++ b/test/common/README.md
@@ -108,11 +108,17 @@ Indicates if there is more than 1gb of total memory.
returned function has not been called exactly `exact` number of times when the
test is complete, then the test will fail.
-### expectWarning(name, expected)
+### expectWarning(name, expected, code)
* `name` [<string>]
* `expected` [<string>] | [<Array>]
+* `code` [<string>]
-Tests whether `name` and `expected` are part of a raised warning.
+Tests whether `name`, `expected`, and `code` are part of a raised warning. If
+an expected warning does not have a code then `common.noWarnCode` can be used
+to indicate this.
+
+### noWarnCode
+See `common.expectWarning()` for usage.
### fileExists(pathname)
* pathname [<string>]
diff --git a/test/common/index.js b/test/common/index.js
index ff1dc0ce26..f13e61df8c 100644
--- a/test/common/index.js
+++ b/test/common/index.js
@@ -611,20 +611,32 @@ exports.isAlive = function isAlive(pid) {
}
};
-function expectWarning(name, expectedMessages) {
+exports.noWarnCode = 'no_expected_warning_code';
+
+function expectWarning(name, expected) {
+ const map = new Map(expected);
return exports.mustCall((warning) => {
assert.strictEqual(warning.name, name);
- assert.ok(expectedMessages.includes(warning.message),
+ assert.ok(map.has(warning.message),
`unexpected error message: "${warning.message}"`);
+ const code = map.get(warning.message);
+ if (code === undefined) {
+ throw new Error('An error code must be specified or use ' +
+ 'common.noWarnCode if there is no error code. The error ' +
+ `code for this warning was ${warning.code}`);
+ }
+ if (code !== exports.noWarnCode) {
+ assert.strictEqual(warning.code, code);
+ }
// Remove a warning message after it is seen so that we guarantee that we
// get each message only once.
- expectedMessages.splice(expectedMessages.indexOf(warning.message), 1);
- }, expectedMessages.length);
+ map.delete(expected);
+ }, map.size);
}
-function expectWarningByName(name, expected) {
+function expectWarningByName(name, expected, code) {
if (typeof expected === 'string') {
- expected = [expected];
+ expected = [[expected, code]];
}
process.on('warning', expectWarning(name, expected));
}
@@ -633,8 +645,15 @@ function expectWarningByMap(warningMap) {
const catchWarning = {};
Object.keys(warningMap).forEach((name) => {
let expected = warningMap[name];
- if (typeof expected === 'string') {
- expected = [expected];
+ if (!Array.isArray(expected)) {
+ throw new Error('warningMap entries must be arrays consisting of two ' +
+ 'entries: [message, warningCode]');
+ }
+ if (!(Array.isArray(expected[0]))) {
+ if (expected.length === 0) {
+ return;
+ }
+ expected = [[expected[0], expected[1]]];
}
catchWarning[name] = expectWarning(name, expected);
});
@@ -644,9 +663,9 @@ function expectWarningByMap(warningMap) {
// accepts a warning name and description or array of descriptions or a map
// of warning names to description(s)
// ensures a warning is generated for each name/description pair
-exports.expectWarning = function(nameOrMap, expected) {
+exports.expectWarning = function(nameOrMap, expected, code) {
if (typeof nameOrMap === 'string') {
- expectWarningByName(nameOrMap, expected);
+ expectWarningByName(nameOrMap, expected, code);
} else {
expectWarningByMap(nameOrMap);
}
diff --git a/test/parallel/test-assert-fail-deprecation.js b/test/parallel/test-assert-fail-deprecation.js
index aab26d4272..68ebcd612d 100644
--- a/test/parallel/test-assert-fail-deprecation.js
+++ b/test/parallel/test-assert-fail-deprecation.js
@@ -6,7 +6,8 @@ const assert = require('assert');
common.expectWarning(
'DeprecationWarning',
'assert.fail() with more than one argument is deprecated. ' +
- 'Please use assert.strictEqual() instead or only pass a message.'
+ 'Please use assert.strictEqual() instead or only pass a message.',
+ 'DEP0094'
);
// Two args only, operator defaults to '!='
diff --git a/test/parallel/test-buffer-pending-deprecation.js b/test/parallel/test-buffer-pending-deprecation.js
index 060eae2a51..15b5a5140e 100644
--- a/test/parallel/test-buffer-pending-deprecation.js
+++ b/test/parallel/test-buffer-pending-deprecation.js
@@ -9,7 +9,7 @@ const bufferWarning = 'The Buffer() and new Buffer() constructors are not ' +
'Buffer.allocUnsafe(), or Buffer.from() construction ' +
'methods instead.';
-common.expectWarning('DeprecationWarning', bufferWarning);
+common.expectWarning('DeprecationWarning', bufferWarning, 'DEP0005');
// This is used to make sure that a warning is only emitted once even though
// `new Buffer()` is called twice.
diff --git a/test/parallel/test-child-process-custom-fds.js b/test/parallel/test-child-process-custom-fds.js
index 910babdd6f..fbfc8776a3 100644
--- a/test/parallel/test-child-process-custom-fds.js
+++ b/test/parallel/test-child-process-custom-fds.js
@@ -9,7 +9,7 @@ const oldSpawnSync = internalCp.spawnSync;
{
const msg = 'child_process: options.customFds option is deprecated. ' +
'Use options.stdio instead.';
- common.expectWarning('DeprecationWarning', msg);
+ common.expectWarning('DeprecationWarning', msg, 'DEP0006');
const customFds = [-1, process.stdout.fd, process.stderr.fd];
internalCp.spawnSync = common.mustCall(function(opts) {
diff --git a/test/parallel/test-crypto-authenticated.js b/test/parallel/test-crypto-authenticated.js
index c016b3500d..9979a1b861 100644
--- a/test/parallel/test-crypto-authenticated.js
+++ b/test/parallel/test-crypto-authenticated.js
@@ -336,13 +336,16 @@ const errMessages = {
const ciphers = crypto.getCiphers();
const expectedWarnings = common.hasFipsCrypto ?
- [] : ['Use Cipheriv for counter mode of aes-192-gcm'];
+ [] : [['Use Cipheriv for counter mode of aes-192-gcm',
+ common.noWarnCode]];
const expectedDeprecationWarnings = [0, 1, 2, 6, 9, 10, 11, 17]
- .map((i) => `Permitting authentication tag lengths of ${i} bytes is ` +
- 'deprecated. Valid GCM tag lengths are 4, 8, 12, 13, 14, 15, 16.');
+ .map((i) => [`Permitting authentication tag lengths of ${i} bytes is ` +
+ 'deprecated. Valid GCM tag lengths are 4, 8, 12, 13, 14, 15, 16.',
+ 'DEP0090']);
-expectedDeprecationWarnings.push('crypto.DEFAULT_ENCODING is deprecated.');
+expectedDeprecationWarnings.push(['crypto.DEFAULT_ENCODING is deprecated.',
+ 'DEP0091']);
common.expectWarning({
Warning: expectedWarnings,
diff --git a/test/parallel/test-crypto-cipher-decipher.js b/test/parallel/test-crypto-cipher-decipher.js
index 75ed26c1ff..89d070aaa8 100644
--- a/test/parallel/test-crypto-cipher-decipher.js
+++ b/test/parallel/test-crypto-cipher-decipher.js
@@ -236,7 +236,8 @@ testCipher2(Buffer.from('0123456789abcdef'));
const data = Buffer.from('test-crypto-cipher-decipher');
common.expectWarning('Warning',
- 'Use Cipheriv for counter mode of aes-256-gcm');
+ 'Use Cipheriv for counter mode of aes-256-gcm',
+ common.noWarnCode);
const cipher = crypto.createCipher('aes-256-gcm', key);
cipher.setAAD(aadbuf);
diff --git a/test/parallel/test-crypto-deprecated.js b/test/parallel/test-crypto-deprecated.js
index d8f2be4369..2a9246a2e0 100644
--- a/test/parallel/test-crypto-deprecated.js
+++ b/test/parallel/test-crypto-deprecated.js
@@ -8,10 +8,12 @@ const crypto = require('crypto');
const tls = require('tls');
common.expectWarning('DeprecationWarning', [
- 'crypto.Credentials is deprecated. Use tls.SecureContext instead.',
- 'crypto.createCredentials is deprecated. Use tls.createSecureContext ' +
- 'instead.',
- 'crypto.Decipher.finaltol is deprecated. Use crypto.Decipher.final instead.'
+ ['crypto.Credentials is deprecated. Use tls.SecureContext instead.',
+ 'DEP0011'],
+ ['crypto.createCredentials is deprecated. Use tls.createSecureContext ' +
+ 'instead.', 'DEP0010'],
+ ['crypto.Decipher.finaltol is deprecated. Use crypto.Decipher.final instead.',
+ 'DEP0105']
]);
// Accessing the deprecated function is enough to trigger the warning event.
diff --git a/test/parallel/test-fs-filehandle.js b/test/parallel/test-fs-filehandle.js
index 761193b6d2..8ddc11ec3e 100644
--- a/test/parallel/test-fs-filehandle.js
+++ b/test/parallel/test-fs-filehandle.js
@@ -20,7 +20,8 @@ let fdnum;
common.expectWarning(
'Warning',
- `Closing file descriptor ${fdnum} on garbage collection`
+ `Closing file descriptor ${fdnum} on garbage collection`,
+ common.noWarnCode
);
gc(); // eslint-disable-line no-undef
diff --git a/test/parallel/test-fs-truncate-fd.js b/test/parallel/test-fs-truncate-fd.js
index ee6f66f720..62634aed1d 100644
--- a/test/parallel/test-fs-truncate-fd.js
+++ b/test/parallel/test-fs-truncate-fd.js
@@ -15,7 +15,7 @@ const msg = 'Using fs.truncate with a file descriptor is deprecated.' +
' Please use fs.ftruncate with a file descriptor instead.';
-common.expectWarning('DeprecationWarning', msg);
+common.expectWarning('DeprecationWarning', msg, 'DEP0081');
fs.truncate(fd, 5, common.mustCall(function(err) {
assert.ok(!err);
assert.strictEqual(fs.readFileSync(filename, 'utf8'), 'hello');
diff --git a/test/parallel/test-fs-truncate.js b/test/parallel/test-fs-truncate.js
index bb6b4bc8b5..62da52b38e 100644
--- a/test/parallel/test-fs-truncate.js
+++ b/test/parallel/test-fs-truncate.js
@@ -64,8 +64,8 @@ fs.ftruncateSync(fd);
stat = fs.statSync(filename);
assert.strictEqual(stat.size, 0);
-// Check truncateSync
-common.expectWarning('DeprecationWarning', msg);
+// truncateSync
+common.expectWarning('DeprecationWarning', msg, 'DEP0081');
fs.truncateSync(fd);
fs.closeSync(fd);
diff --git a/test/parallel/test-net-server-connections.js b/test/parallel/test-net-server-connections.js
index c424d2a729..9e1213ada5 100644
--- a/test/parallel/test-net-server-connections.js
+++ b/test/parallel/test-net-server-connections.js
@@ -30,7 +30,7 @@ const server = new net.Server();
const expectedWarning = 'Server.connections property is deprecated. ' +
'Use Server.getConnections method instead.';
-common.expectWarning('DeprecationWarning', expectedWarning);
+common.expectWarning('DeprecationWarning', expectedWarning, 'DEP0020');
// test that server.connections property is no longer enumerable now that it
// has been marked as deprecated
diff --git a/test/parallel/test-performance-warning.js b/test/parallel/test-performance-warning.js
index f3104677a7..6a7d6f7b94 100644
--- a/test/parallel/test-performance-warning.js
+++ b/test/parallel/test-performance-warning.js
@@ -20,10 +20,10 @@ performance.maxEntries = 1;
);
});
-common.expectWarning('Warning', [
- 'Possible perf_hooks memory leak detected. There are 2 entries in the ' +
+common.expectWarning('Warning', 'Possible perf_hooks memory leak detected. ' +
+ 'There are 2 entries in the ' +
'Performance Timeline. Use the clear methods to remove entries that are no ' +
'longer needed or set performance.maxEntries equal to a higher value ' +
- '(currently the maxEntries is 1).']);
+ '(currently the maxEntries is 1).', common.noWarnCode);
performance.mark('test');
diff --git a/test/parallel/test-process-assert.js b/test/parallel/test-process-assert.js
index 659fa8ed7a..74792eebb7 100644
--- a/test/parallel/test-process-assert.js
+++ b/test/parallel/test-process-assert.js
@@ -4,7 +4,8 @@ const assert = require('assert');
common.expectWarning(
'DeprecationWarning',
- 'process.assert() is deprecated. Please use the `assert` module instead.'
+ 'process.assert() is deprecated. Please use the `assert` module instead.',
+ 'DEP0100'
);
assert.strictEqual(process.assert(1, 'error'), undefined);
diff --git a/test/parallel/test-process-emit-warning-from-native.js b/test/parallel/test-process-emit-warning-from-native.js
index d50ea3962b..d3e2454ada 100644
--- a/test/parallel/test-process-emit-warning-from-native.js
+++ b/test/parallel/test-process-emit-warning-from-native.js
@@ -12,7 +12,8 @@ const key = '0123456789';
{
common.expectWarning('Warning',
- 'Use Cipheriv for counter mode of aes-256-gcm');
+ 'Use Cipheriv for counter mode of aes-256-gcm',
+ common.noWarnCode);
// Emits regular warning expected by expectWarning()
crypto.createCipher('aes-256-gcm', key);
diff --git a/test/parallel/test-process-env-deprecation.js b/test/parallel/test-process-env-deprecation.js
index 310023fba7..68817b320b 100644
--- a/test/parallel/test-process-env-deprecation.js
+++ b/test/parallel/test-process-env-deprecation.js
@@ -8,7 +8,8 @@ common.expectWarning(
'DeprecationWarning',
'Assigning any value other than a string, number, or boolean to a ' +
'process.env property is deprecated. Please make sure to convert the value ' +
- 'to a string before setting process.env with it.'
+ 'to a string before setting process.env with it.',
+ 'DEP0104'
);
process.env.ABC = undefined;
diff --git a/test/parallel/test-promises-unhandled-proxy-rejections.js b/test/parallel/test-promises-unhandled-proxy-rejections.js
index f632857d63..dfd1ee322a 100644
--- a/test/parallel/test-promises-unhandled-proxy-rejections.js
+++ b/test/parallel/test-promises-unhandled-proxy-rejections.js
@@ -1,16 +1,16 @@
'use strict';
const common = require('../common');
-const expectedDeprecationWarning = 'Unhandled promise rejections are ' +
+const expectedDeprecationWarning = ['Unhandled promise rejections are ' +
'deprecated. In the future, promise ' +
'rejections that are not handled will ' +
'terminate the Node.js process with a ' +
- 'non-zero exit code.';
-const expectedPromiseWarning = 'Unhandled promise rejection. ' +
+ 'non-zero exit code.', 'DEP0018'];
+const expectedPromiseWarning = ['Unhandled promise rejection. ' +
'This error originated either by throwing ' +
'inside of an async function without a catch ' +
'block, or by rejecting a promise which was ' +
- 'not handled with .catch(). (rejection id: 1)';
+ 'not handled with .catch(). (rejection id: 1)', common.noWarnCode];
function throwErr() {
throw new Error('Error from proxy');
diff --git a/test/parallel/test-promises-unhandled-symbol-rejections.js b/test/parallel/test-promises-unhandled-symbol-rejections.js
index 3e687d4e49..5c028a74c2 100644
--- a/test/parallel/test-promises-unhandled-symbol-rejections.js
+++ b/test/parallel/test-promises-unhandled-symbol-rejections.js
@@ -1,17 +1,17 @@
'use strict';
const common = require('../common');
-const expectedValueWarning = 'Symbol()';
-const expectedDeprecationWarning = 'Unhandled promise rejections are ' +
+const expectedValueWarning = ['Symbol()', common.noWarnCode];
+const expectedDeprecationWarning = ['Unhandled promise rejections are ' +
'deprecated. In the future, promise ' +
'rejections that are not handled will ' +
'terminate the Node.js process with a ' +
- 'non-zero exit code.';
-const expectedPromiseWarning = 'Unhandled promise rejection. ' +
+ 'non-zero exit code.', common.noWarnCode];
+const expectedPromiseWarning = ['Unhandled promise rejection. ' +
'This error originated either by throwing ' +
'inside of an async function without a catch ' +
'block, or by rejecting a promise which was ' +
- 'not handled with .catch(). (rejection id: 1)';
+ 'not handled with .catch(). (rejection id: 1)', common.noWarnCode];
common.expectWarning({
DeprecationWarning: expectedDeprecationWarning,
diff --git a/test/parallel/test-repl-deprecations.js b/test/parallel/test-repl-deprecations.js
index c2a97ad7ac..dbd50eb469 100644
--- a/test/parallel/test-repl-deprecations.js
+++ b/test/parallel/test-repl-deprecations.js
@@ -9,7 +9,7 @@ function testParseREPLKeyword() {
const server = repl.start({ prompt: '> ' });
const warn = 'REPLServer.parseREPLKeyword() is deprecated';
- common.expectWarning('DeprecationWarning', warn);
+ common.expectWarning('DeprecationWarning', warn, 'DEP0075');
assert.ok(server.parseREPLKeyword('clear'));
assert.ok(!server.parseREPLKeyword('tacos'));
server.close();
diff --git a/test/parallel/test-repl-memory-deprecation.js b/test/parallel/test-repl-memory-deprecation.js
index 9993360a28..07d377d8fb 100644
--- a/test/parallel/test-repl-memory-deprecation.js
+++ b/test/parallel/test-repl-memory-deprecation.js
@@ -9,7 +9,7 @@ function testMemory() {
const server = repl.start({ prompt: '> ' });
const warn = 'REPLServer.memory() is deprecated';
- common.expectWarning('DeprecationWarning', warn);
+ common.expectWarning('DeprecationWarning', warn, 'DEP0082');
assert.strictEqual(server.memory(), undefined);
server.close();
}
diff --git a/test/parallel/test-repl-turn-off-editor-mode.js b/test/parallel/test-repl-turn-off-editor-mode.js
index c98520c9ec..a966899b2c 100644
--- a/test/parallel/test-repl-turn-off-editor-mode.js
+++ b/test/parallel/test-repl-turn-off-editor-mode.js
@@ -8,7 +8,7 @@ function testTurnOffEditorMode() {
const server = repl.start({ prompt: '> ' });
const warn = 'REPLServer.turnOffEditorMode() is deprecated';
- common.expectWarning('DeprecationWarning', warn);
+ common.expectWarning('DeprecationWarning', warn, 'DEP0078');
server.turnOffEditorMode();
server.close();
}
diff --git a/test/parallel/test-require-deps-deprecation.js b/test/parallel/test-require-deps-deprecation.js
index b588fa4da9..24a2e86e6a 100644
--- a/test/parallel/test-require-deps-deprecation.js
+++ b/test/parallel/test-require-deps-deprecation.js
@@ -29,8 +29,8 @@ const deps = [
];
common.expectWarning('DeprecationWarning', deprecatedModules.map((m) => {
- return `Requiring Node.js-bundled '${m}' module is deprecated. ` +
- 'Please install the necessary module locally.';
+ return [`Requiring Node.js-bundled '${m}' module is deprecated. ` +
+ 'Please install the necessary module locally.', 'DEP0084'];
}));
for (const m of deprecatedModules) {
diff --git a/test/parallel/test-tls-dhe.js b/test/parallel/test-tls-dhe.js
index 177f6f2eb2..9fbd8d980c 100644
--- a/test/parallel/test-tls-dhe.js
+++ b/test/parallel/test-tls-dhe.js
@@ -41,7 +41,8 @@ const ciphers = 'DHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
// Test will emit a warning because the DH parameter size is < 2048 bits
common.expectWarning('SecurityWarning',
- 'DH parameter is less than 2048 bits');
+ 'DH parameter is less than 2048 bits',
+ common.noWarnCode);
function loadDHParam(n) {
const params = [`dh${n}.pem`];
diff --git a/test/parallel/test-tls-ecdh-disable.js b/test/parallel/test-tls-ecdh-disable.js
index 7726a0655e..1109b71dbe 100644
--- a/test/parallel/test-tls-ecdh-disable.js
+++ b/test/parallel/test-tls-ecdh-disable.js
@@ -48,7 +48,8 @@ const options = {
};
common.expectWarning('DeprecationWarning',
- '{ ecdhCurve: false } is deprecated.');
+ '{ ecdhCurve: false } is deprecated.',
+ 'DEP0083');
const server = tls.createServer(options, common.mustNotCall());
diff --git a/test/parallel/test-tls-legacy-deprecated.js b/test/parallel/test-tls-legacy-deprecated.js
index c2560daf21..8aa8fd31d2 100644
--- a/test/parallel/test-tls-legacy-deprecated.js
+++ b/test/parallel/test-tls-legacy-deprecated.js
@@ -8,7 +8,8 @@ const tls = require('tls');
common.expectWarning(
'DeprecationWarning',
- 'tls.createSecurePair() is deprecated. Please use tls.TLSSocket instead.'
+ 'tls.createSecurePair() is deprecated. Please use tls.TLSSocket instead.',
+ 'DEP0064'
);
tls.createSecurePair();
diff --git a/test/parallel/test-tls-parse-cert-string.js b/test/parallel/test-tls-parse-cert-string.js
index 78e570d088..a0bafe9c52 100644
--- a/test/parallel/test-tls-parse-cert-string.js
+++ b/test/parallel/test-tls-parse-cert-string.js
@@ -59,7 +59,8 @@ common.restoreStderr();
{
common.expectWarning('DeprecationWarning',
'tls.parseCertString() is deprecated. ' +
- 'Please use querystring.parse() instead.');
+ 'Please use querystring.parse() instead.',
+ 'DEP0076');
const ret = tls.parseCertString('foo=bar');
assert.deepStrictEqual(ret, { __proto__: null, foo: 'bar' });
diff --git a/test/parallel/test-util-inspect-deprecated.js b/test/parallel/test-util-inspect-deprecated.js
index adabb06697..476bda4daa 100644
--- a/test/parallel/test-util-inspect-deprecated.js
+++ b/test/parallel/test-util-inspect-deprecated.js
@@ -11,7 +11,8 @@ const util = require('util');
// `common.expectWarning` will expect the warning exactly one time only
common.expectWarning(
'DeprecationWarning',
- 'Custom inspection function on Objects via .inspect() is deprecated'
+ 'Custom inspection function on Objects via .inspect() is deprecated',
+ 'DEP0079'
);
util.inspect(target); // should emit deprecation warning
util.inspect(target); // should not emit deprecation warning
diff --git a/test/parallel/test-util.js b/test/parallel/test-util.js
index a60e0d5b53..ee2fe917f3 100644
--- a/test/parallel/test-util.js
+++ b/test/parallel/test-util.js
@@ -142,10 +142,10 @@ assert.strictEqual(util.isFunction(), false);
assert.strictEqual(util.isFunction('string'), false);
common.expectWarning('DeprecationWarning', [
- 'util.print is deprecated. Use console.log instead.',
- 'util.puts is deprecated. Use console.log instead.',
- 'util.debug is deprecated. Use console.error instead.',
- 'util.error is deprecated. Use console.error instead.'
+ ['util.print is deprecated. Use console.log instead.', common.noWarnCode],
+ ['util.puts is deprecated. Use console.log instead.', common.noWarnCode],
+ ['util.debug is deprecated. Use console.error instead.', common.noWarnCode],
+ ['util.error is deprecated. Use console.error instead.', common.noWarnCode]
]);
util.print('test');
diff --git a/test/parallel/test-warn-sigprof.js b/test/parallel/test-warn-sigprof.js
index 3404490c2a..71ac25443b 100644
--- a/test/parallel/test-warn-sigprof.js
+++ b/test/parallel/test-warn-sigprof.js
@@ -10,6 +10,7 @@ if (common.isWindows)
common.skip('test does not apply to Windows');
common.expectWarning('Warning',
- 'process.on(SIGPROF) is reserved while debugging');
+ 'process.on(SIGPROF) is reserved while debugging',
+ common.noWarnCode);
process.on('SIGPROF', () => {});