Skip to content

Commit b84f495

Browse files
committed
test: remove common.noWarnCode
This property was just sugar for `undefined` and did not check much. Now that we properly check that a DeprecationWarning requires a code we do not have to check that a code is always present.
1 parent 3d579f6 commit b84f495

16 files changed

+43
-59
lines changed

test/common/README.md

+2-8
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,7 @@ Indicates if there is more than 1gb of total memory.
114114
* `expected` [<string>] | [<Array>] | [<Object>]
115115
* `code` [<string>]
116116

117-
Tests whether `name`, `expected`, and `code` are part of a raised warning. If
118-
an expected warning does not have a code then `common.noWarnCode` can be used
119-
to indicate this.
117+
Tests whether `name`, `expected`, and `code` are part of a raised warning.
120118

121119
The code is required in case the name is set to `'DeprecationWarning'`.
122120

@@ -135,7 +133,7 @@ expectWarning('DeprecationWarning', [
135133

136134
expectWarning('DeprecationWarning', [
137135
['Foobar is deprecated', 'DEP0XXX'],
138-
['Baz is also deprecated', noWarnCode]
136+
['Baz is also deprecated']
139137
]);
140138

141139
expectWarning('DeprecationWarning', {
@@ -149,7 +147,6 @@ expectWarning({
149147
DEP0XX1: 'Baz is also deprecated'
150148
},
151149
Warning: [
152-
['Foobar', noWarnCode],
153150
['Multiple array entries are fine', 'DEP0XXX'],
154151
['No code is also fine']
155152
],
@@ -302,9 +299,6 @@ Returns `true` if the exit code `exitCode` and/or signal name `signal` represent
302299
the exit code and/or signal name of a node process that aborted, `false`
303300
otherwise.
304301

305-
### noWarnCode
306-
See `common.expectWarning()` for usage.
307-
308302
### opensslCli
309303
* [<boolean>]
310304

test/common/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,6 @@ module.exports = {
748748
mustCallAtLeast,
749749
mustNotCall,
750750
nodeProcessAborted,
751-
noWarnCode: undefined,
752751
PIPE,
753752
platformTimeout,
754753
printSkipMessage,

test/common/index.mjs

-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ const {
3737
nodeProcessAborted,
3838
busyLoop,
3939
isAlive,
40-
noWarnCode,
4140
expectWarning,
4241
expectsError,
4342
skipIfInspectorDisabled,
@@ -84,7 +83,6 @@ export {
8483
nodeProcessAborted,
8584
busyLoop,
8685
isAlive,
87-
noWarnCode,
8886
expectWarning,
8987
expectsError,
9088
skipIfInspectorDisabled,

test/parallel/test-atomics-notify.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
const { expectWarning, noWarnCode } = require('../common');
3+
const { expectWarning } = require('../common');
44

55
const assert = require('assert');
66
const { runInNewContext } = require('vm');
@@ -14,6 +14,6 @@ assert.strictEqual(runInNewContext('typeof Atomics.notify'), 'function');
1414
expectWarning(
1515
'Atomics',
1616
'Atomics.wake will be removed in a future version, ' +
17-
'use Atomics.notify instead.', noWarnCode);
17+
'use Atomics.notify instead.');
1818

1919
Atomics.wake(new Int32Array(new SharedArrayBuffer(4)), 0, 0);

test/parallel/test-console.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ if (common.isMainThread) {
4242
common.expectWarning(
4343
'Warning',
4444
[
45-
['Count for \'noLabel\' does not exist', common.noWarnCode],
46-
['No such label \'noLabel\' for console.timeLog()', common.noWarnCode],
47-
['No such label \'noLabel\' for console.timeEnd()', common.noWarnCode],
48-
['Count for \'default\' does not exist', common.noWarnCode],
49-
['No such label \'default\' for console.timeLog()', common.noWarnCode],
50-
['No such label \'default\' for console.timeEnd()', common.noWarnCode],
51-
['Label \'default\' already exists for console.time()', common.noWarnCode],
52-
['Label \'test\' already exists for console.time()', common.noWarnCode]
45+
['Count for \'noLabel\' does not exist'],
46+
['No such label \'noLabel\' for console.timeLog()'],
47+
['No such label \'noLabel\' for console.timeEnd()'],
48+
['Count for \'default\' does not exist'],
49+
['No such label \'default\' for console.timeLog()'],
50+
['No such label \'default\' for console.timeEnd()'],
51+
['Label \'default\' already exists for console.time()'],
52+
['Label \'test\' already exists for console.time()']
5353
]
5454
);
5555

test/parallel/test-crypto-authenticated.js

+19-19
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,25 @@ const ciphers = crypto.getCiphers();
5050

5151
const expectedWarnings = common.hasFipsCrypto ?
5252
[] : [
53-
['Use Cipheriv for counter mode of aes-192-gcm', common.noWarnCode],
54-
['Use Cipheriv for counter mode of aes-192-ccm', common.noWarnCode],
55-
['Use Cipheriv for counter mode of aes-192-ccm', common.noWarnCode],
56-
['Use Cipheriv for counter mode of aes-128-ccm', common.noWarnCode],
57-
['Use Cipheriv for counter mode of aes-128-ccm', common.noWarnCode],
58-
['Use Cipheriv for counter mode of aes-128-ccm', common.noWarnCode],
59-
['Use Cipheriv for counter mode of aes-256-ccm', common.noWarnCode],
60-
['Use Cipheriv for counter mode of aes-256-ccm', common.noWarnCode],
61-
['Use Cipheriv for counter mode of aes-256-ccm', common.noWarnCode],
62-
['Use Cipheriv for counter mode of aes-256-ccm', common.noWarnCode],
63-
['Use Cipheriv for counter mode of aes-256-ccm', common.noWarnCode],
64-
['Use Cipheriv for counter mode of aes-256-ccm', common.noWarnCode],
65-
['Use Cipheriv for counter mode of aes-256-ccm', common.noWarnCode],
66-
['Use Cipheriv for counter mode of aes-256-ccm', common.noWarnCode],
67-
['Use Cipheriv for counter mode of aes-256-ccm', common.noWarnCode],
68-
['Use Cipheriv for counter mode of aes-256-ccm', common.noWarnCode],
69-
['Use Cipheriv for counter mode of aes-256-ccm', common.noWarnCode],
70-
['Use Cipheriv for counter mode of aes-256-ccm', common.noWarnCode],
71-
['Use Cipheriv for counter mode of aes-256-ccm', common.noWarnCode]
53+
['Use Cipheriv for counter mode of aes-192-gcm'],
54+
['Use Cipheriv for counter mode of aes-192-ccm'],
55+
['Use Cipheriv for counter mode of aes-192-ccm'],
56+
['Use Cipheriv for counter mode of aes-128-ccm'],
57+
['Use Cipheriv for counter mode of aes-128-ccm'],
58+
['Use Cipheriv for counter mode of aes-128-ccm'],
59+
['Use Cipheriv for counter mode of aes-256-ccm'],
60+
['Use Cipheriv for counter mode of aes-256-ccm'],
61+
['Use Cipheriv for counter mode of aes-256-ccm'],
62+
['Use Cipheriv for counter mode of aes-256-ccm'],
63+
['Use Cipheriv for counter mode of aes-256-ccm'],
64+
['Use Cipheriv for counter mode of aes-256-ccm'],
65+
['Use Cipheriv for counter mode of aes-256-ccm'],
66+
['Use Cipheriv for counter mode of aes-256-ccm'],
67+
['Use Cipheriv for counter mode of aes-256-ccm'],
68+
['Use Cipheriv for counter mode of aes-256-ccm'],
69+
['Use Cipheriv for counter mode of aes-256-ccm'],
70+
['Use Cipheriv for counter mode of aes-256-ccm'],
71+
['Use Cipheriv for counter mode of aes-256-ccm']
7272
];
7373

7474
const expectedDeprecationWarnings = [

test/parallel/test-crypto-cipher-decipher.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const assert = require('assert');
1212

1313
common.expectWarning({
1414
Warning: [
15-
['Use Cipheriv for counter mode of aes-256-gcm', common.noWarnCode]
15+
['Use Cipheriv for counter mode of aes-256-gcm']
1616
],
1717
DeprecationWarning: [
1818
['crypto.createCipher is deprecated.', 'DEP0106']

test/parallel/test-fs-filehandle.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@ let fdnum;
2121

2222
common.expectWarning({
2323
'internal/test/binding': [
24-
'These APIs are for internal testing only. Do not use them.',
25-
common.noWarnCode
24+
'These APIs are for internal testing only. Do not use them.'
2625
],
2726
'Warning': [
28-
`Closing file descriptor ${fdnum} on garbage collection`,
29-
common.noWarnCode
27+
`Closing file descriptor ${fdnum} on garbage collection`
3028
]
3129
});
3230

test/parallel/test-https-strict.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ common.expectWarning(
3232
'Warning',
3333
'Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to \'0\' ' +
3434
'makes TLS connections and HTTPS requests insecure by disabling ' +
35-
'certificate verification.',
36-
common.noWarnCode
35+
'certificate verification.'
3736
);
3837

3938
const assert = require('assert');

test/parallel/test-process-emit-warning-from-native.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const key = '0123456789';
1616
['crypto.createCipher is deprecated.', 'DEP0106']
1717
],
1818
Warning: [
19-
['Use Cipheriv for counter mode of aes-256-gcm', common.noWarnCode]
19+
['Use Cipheriv for counter mode of aes-256-gcm']
2020
]
2121
});
2222

test/parallel/test-promises-unhandled-proxy-rejections.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const expectedPromiseWarning = ['Unhandled promise rejection. ' +
1212
'This error originated either by throwing ' +
1313
'inside of an async function without a catch ' +
1414
'block, or by rejecting a promise which was ' +
15-
'not handled with .catch(). (rejection id: 1)', common.noWarnCode];
15+
'not handled with .catch(). (rejection id: 1)'];
1616

1717
function throwErr() {
1818
throw new Error('Error from proxy');

test/parallel/test-promises-unhandled-symbol-rejections.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const common = require('../common');
33

44
common.disableCrashOnUnhandledRejection();
55

6-
const expectedValueWarning = ['Symbol()', common.noWarnCode];
6+
const expectedValueWarning = ['Symbol()'];
77
const expectedDeprecationWarning = ['Unhandled promise rejections are ' +
88
'deprecated. In the future, promise ' +
99
'rejections that are not handled will ' +
@@ -13,7 +13,7 @@ const expectedPromiseWarning = ['Unhandled promise rejection. ' +
1313
'This error originated either by throwing ' +
1414
'inside of an async function without a catch ' +
1515
'block, or by rejecting a promise which was ' +
16-
'not handled with .catch(). (rejection id: 1)', common.noWarnCode];
16+
'not handled with .catch(). (rejection id: 1)'];
1717

1818
common.expectWarning({
1919
DeprecationWarning: expectedDeprecationWarning,

test/parallel/test-tls-dhe.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ const ciphers = 'DHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
4141

4242
// Test will emit a warning because the DH parameter size is < 2048 bits
4343
common.expectWarning('SecurityWarning',
44-
'DH parameter is less than 2048 bits',
45-
common.noWarnCode);
44+
'DH parameter is less than 2048 bits');
4645

4746
function loadDHParam(n) {
4847
const params = [`dh${n}.pem`];

test/parallel/test-trace-events-api.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ if (isChild) {
9999
common.expectWarning(
100100
'Warning',
101101
'Possible trace_events memory leak detected. There are more than ' +
102-
'10 enabled Tracing objects.',
103-
common.noWarnCode);
102+
'10 enabled Tracing objects.');
104103
for (let n = 0; n < 10; n++) {
105104
const tracing = createTracing({ categories: [ `a${n}` ] });
106105
tracing.enable();

test/parallel/test-warn-sigprof.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ if (common.isWindows)
1313
common.skipIfWorker(); // Worker inspector never has a server running
1414

1515
common.expectWarning('Warning',
16-
'process.on(SIGPROF) is reserved while debugging',
17-
common.noWarnCode);
16+
'process.on(SIGPROF) is reserved while debugging');
1817

1918
process.on('SIGPROF', () => {});

test/parallel/test-worker-message-port-transfer-target.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ const arrayBuf = new ArrayBuffer(10);
1111

1212
common.expectWarning('Warning',
1313
'The target port was posted to itself, and the ' +
14-
'communication channel was lost',
15-
common.noWarnCode);
14+
'communication channel was lost');
1615
port2.onmessage = common.mustNotCall();
1716
port2.postMessage(null, [port1, arrayBuf]);
1817

0 commit comments

Comments
 (0)