From 3ec5b482bdcf5642b955fc166585295d904b4749 Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Fri, 11 Sep 2020 17:50:21 +0300 Subject: [PATCH] lib: change ERR_INVALID_ARG_VALUE error message Refs: https://github.com/nodejs/node/pull/34682/#discussion_r475241035 --- lib/internal/errors.js | 2 +- test/es-module/test-esm-dns-promises.mjs | 2 +- test/internet/test-dns-promises-resolve.js | 2 +- test/parallel/test-assert.js | 2 +- .../test-buffer-no-negative-allocation.js | 2 +- test/parallel/test-buffer-over-max-length.js | 2 +- test/parallel/test-buffer-slow.js | 2 +- .../test-buffer-tostring-rangeerror.js | 2 +- test/parallel/test-c-ares.js | 2 +- ...st-child-process-advanced-serialization.js | 2 +- test/parallel/test-console-tty-colors.js | 2 +- test/parallel/test-crypto-authenticated.js | 10 ++--- test/parallel/test-crypto-dh-stateless.js | 4 +- test/parallel/test-crypto-key-objects.js | 6 +-- test/parallel/test-crypto-keygen.js | 38 +++++++++---------- test/parallel/test-crypto-sign-verify.js | 4 +- test/parallel/test-crypto.js | 2 +- test/parallel/test-dns-lookup.js | 4 +- test/parallel/test-dns.js | 4 +- test/parallel/test-fs-chmod.js | 2 +- test/parallel/test-fs-fchmod.js | 2 +- test/parallel/test-fs-lchmod.js | 2 +- test/parallel/test-fs-open.js | 6 +-- test/parallel/test-fs-read-empty-buffer.js | 6 +-- test/parallel/test-fs-whatwg-url.js | 4 +- test/parallel/test-http-agent-scheduling.js | 2 +- ...est-http2-client-request-options-errors.js | 2 +- ...test-http2-compat-serverrequest-headers.js | 2 +- .../test-http2-respond-file-errors.js | 2 +- .../test-http2-respond-file-fd-errors.js | 2 +- .../test-internal-validators-validateoneof.js | 6 +-- test/parallel/test-module-create-require.js | 2 +- test/parallel/test-module-loading-error.js | 2 +- .../parallel/test-net-connect-options-port.js | 2 +- .../test-net-server-listen-options.js | 4 +- test/parallel/test-performanceobserver.js | 2 +- test/parallel/test-process-cpuUsage.js | 4 +- test/parallel/test-process-umask.js | 4 +- ...st-stream-transform-split-highwatermark.js | 4 +- test/parallel/test-streams-highwatermark.js | 2 +- test/parallel/test-vm-module-basic.js | 2 +- .../test-worker-unsupported-eval-on-url.mjs | 2 +- 42 files changed, 81 insertions(+), 81 deletions(-) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 1c2ef24369be1f..29d4fd9550cba1 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -1083,7 +1083,7 @@ E('ERR_INVALID_ARG_VALUE', (name, value, reason = 'is invalid') => { inspected = `${inspected.slice(0, 128)}...`; } const type = name.includes('.') ? 'property' : 'argument'; - return `The ${type} '${name}' ${reason}. Received ${inspected}`; + return `The '${name}' ${type} ${reason}. Received ${inspected}`; }, TypeError, RangeError); E('ERR_INVALID_ASYNC_ID', 'Invalid %s value: %s', RangeError); E('ERR_INVALID_BUFFER_SIZE', diff --git a/test/es-module/test-esm-dns-promises.mjs b/test/es-module/test-esm-dns-promises.mjs index 149682db02d042..3b855ad6752dc7 100644 --- a/test/es-module/test-esm-dns-promises.mjs +++ b/test/es-module/test-esm-dns-promises.mjs @@ -10,5 +10,5 @@ assert.throws(() => { }, { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: `The argument 'address' is invalid. Received '${invalidAddress}'` + message: `The 'address' argument is invalid. Received '${invalidAddress}'` }); diff --git a/test/internet/test-dns-promises-resolve.js b/test/internet/test-dns-promises-resolve.js index d9607a44f60e31..cc5a12649f217c 100644 --- a/test/internet/test-dns-promises-resolve.js +++ b/test/internet/test-dns-promises-resolve.js @@ -12,7 +12,7 @@ const dnsPromises = require('dns').promises; { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: `The argument 'rrtype' is invalid. Received '${rrtype}'` + message: `The 'rrtype' is invalid. Received '${rrtype}' argument` } ); } diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index cbbf091f04b8a7..3927fc7d33899f 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -1082,7 +1082,7 @@ assert.throws( assert.throws( () => assert.throws(() => { throw new Error(); }, {}), { - message: "The argument 'error' may not be an empty object. Received {}", + message: "The 'error' argument may not be an empty object. Received {}", code: 'ERR_INVALID_ARG_VALUE' } ); diff --git a/test/parallel/test-buffer-no-negative-allocation.js b/test/parallel/test-buffer-no-negative-allocation.js index 3d0d1919381f4c..c292253592b35c 100644 --- a/test/parallel/test-buffer-no-negative-allocation.js +++ b/test/parallel/test-buffer-no-negative-allocation.js @@ -7,7 +7,7 @@ const { SlowBuffer } = require('buffer'); const msg = { code: 'ERR_INVALID_ARG_VALUE', name: 'RangeError', - message: /^The argument 'size' is invalid\. Received [^"]*$/ + message: /^The 'size' argument is invalid\. Received [^"]*$/ }; // Test that negative Buffer length inputs throw errors. diff --git a/test/parallel/test-buffer-over-max-length.js b/test/parallel/test-buffer-over-max-length.js index f02c4d1ddd35cd..0e2b5b77958066 100644 --- a/test/parallel/test-buffer-over-max-length.js +++ b/test/parallel/test-buffer-over-max-length.js @@ -9,7 +9,7 @@ const kMaxLength = buffer.kMaxLength; const bufferMaxSizeMsg = { code: 'ERR_INVALID_ARG_VALUE', name: 'RangeError', - message: /^The argument 'size' is invalid\. Received [^"]*$/ + message: /^The 'size' argument is invalid\. Received [^"]*$/ }; assert.throws(() => Buffer((-1 >>> 0) + 1), bufferMaxSizeMsg); diff --git a/test/parallel/test-buffer-slow.js b/test/parallel/test-buffer-slow.js index 70c7846beec68a..d4a3a696878f4a 100644 --- a/test/parallel/test-buffer-slow.js +++ b/test/parallel/test-buffer-slow.js @@ -54,7 +54,7 @@ assert.throws(() => SlowBuffer(true), bufferInvalidTypeMsg); const bufferMaxSizeMsg = { code: 'ERR_INVALID_ARG_VALUE', name: 'RangeError', - message: /^The argument 'size' is invalid\. Received [^"]*$/ + message: /^The 'size' argument is invalid\. Received [^"]*$/ }; assert.throws(() => SlowBuffer(NaN), bufferMaxSizeMsg); assert.throws(() => SlowBuffer(Infinity), bufferMaxSizeMsg); diff --git a/test/parallel/test-buffer-tostring-rangeerror.js b/test/parallel/test-buffer-tostring-rangeerror.js index 4416effb422ac4..ef1c683b8f8cbd 100644 --- a/test/parallel/test-buffer-tostring-rangeerror.js +++ b/test/parallel/test-buffer-tostring-rangeerror.js @@ -12,7 +12,7 @@ const len = 1422561062959; const message = { code: 'ERR_INVALID_ARG_VALUE', name: 'RangeError', - message: /^The argument 'size' is invalid\. Received [^"]*$/ + message: /^The 'size' argument is invalid\. Received [^"]*$/ }; assert.throws(() => Buffer(len).toString('utf8'), message); assert.throws(() => SlowBuffer(len).toString('utf8'), message); diff --git a/test/parallel/test-c-ares.js b/test/parallel/test-c-ares.js index 87ff8c58f970fe..553e24ef947a5f 100644 --- a/test/parallel/test-c-ares.js +++ b/test/parallel/test-c-ares.js @@ -70,7 +70,7 @@ dns.lookup('::1', common.mustCall((error, result, addressType) => { const err = { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: `The argument 'rrtype' is invalid. Received '${val}'`, + message: `The 'rrtype' argument is invalid. Received '${val}'`, }; assert.throws( diff --git a/test/parallel/test-child-process-advanced-serialization.js b/test/parallel/test-child-process-advanced-serialization.js index 71a0c44a042d31..e0dc8466bf7b08 100644 --- a/test/parallel/test-child-process-advanced-serialization.js +++ b/test/parallel/test-child-process-advanced-serialization.js @@ -11,7 +11,7 @@ if (process.argv[2] !== 'child') { child_process.spawn(process.execPath, [], { serialization: value }); }, { code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.serialization' " + + message: "The 'options.serialization' property " + "must be one of: undefined, 'json', 'advanced'. " + `Received ${inspect(value)}` }); diff --git a/test/parallel/test-console-tty-colors.js b/test/parallel/test-console-tty-colors.js index e906c71c186177..5131da64bc829e 100644 --- a/test/parallel/test-console-tty-colors.js +++ b/test/parallel/test-console-tty-colors.js @@ -67,7 +67,7 @@ check(false, false, false); }); }, { - message: `The argument 'colorMode' is invalid. Received ${received}`, + message: `The 'colorMode' argument is invalid. Received ${received}`, code: 'ERR_INVALID_ARG_VALUE' } ); diff --git a/test/parallel/test-crypto-authenticated.js b/test/parallel/test-crypto-authenticated.js index 6cf14f70e4d437..58b11cbe8f9459 100644 --- a/test/parallel/test-crypto-authenticated.js +++ b/test/parallel/test-crypto-authenticated.js @@ -330,7 +330,7 @@ for (const test of TEST_CASES) { }, { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.authTagLength' is invalid. " + + message: "The 'options.authTagLength' property is invalid. " + `Received ${inspect(authTagLength)}` }); @@ -344,7 +344,7 @@ for (const test of TEST_CASES) { }, { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.authTagLength' is invalid. " + + message: "The 'options.authTagLength' property is invalid. " + `Received ${inspect(authTagLength)}` }); @@ -354,7 +354,7 @@ for (const test of TEST_CASES) { }, { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.authTagLength' is invalid. " + + message: "The 'options.authTagLength' property is invalid. " + `Received ${inspect(authTagLength)}` }); @@ -363,7 +363,7 @@ for (const test of TEST_CASES) { }, { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.authTagLength' is invalid. " + + message: "The 'options.authTagLength' property is invalid. " + `Received ${inspect(authTagLength)}` }); } @@ -454,7 +454,7 @@ for (const test of TEST_CASES) { }, { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.plaintextLength' is invalid. " + + message: "The 'options.plaintextLength' property is invalid. " + `Received ${inspect(plaintextLength)}` }); } diff --git a/test/parallel/test-crypto-dh-stateless.js b/test/parallel/test-crypto-dh-stateless.js index ca1bc83112b95b..b9996647c776b2 100644 --- a/test/parallel/test-crypto-dh-stateless.js +++ b/test/parallel/test-crypto-dh-stateless.js @@ -92,13 +92,13 @@ const bobPublicKey = crypto.createPublicKey({ assert.throws(() => crypto.diffieHellman({ privateKey: alicePrivateKey }), { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.publicKey' is invalid. Received undefined" + message: "The 'options.publicKey' property is invalid. Received undefined" }); assert.throws(() => crypto.diffieHellman({ publicKey: alicePublicKey }), { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.privateKey' is invalid. Received undefined" + message: "The 'options.privateKey' property is invalid. Received undefined" }); const privateKey = Buffer.from( diff --git a/test/parallel/test-crypto-key-objects.js b/test/parallel/test-crypto-key-objects.js index ae818152a567f1..830da6c879fd58 100644 --- a/test/parallel/test-crypto-key-objects.js +++ b/test/parallel/test-crypto-key-objects.js @@ -49,7 +49,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem', assert.throws(() => new KeyObject(TYPE), { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: `The argument 'type' is invalid. Received '${TYPE}'` + message: `The 'type' argument is invalid. Received '${TYPE}'` }); } @@ -224,7 +224,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem', createPrivateKey({ key: Buffer.alloc(0), format: 'der', type: 'spki' }); }, { code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.type' is invalid. Received 'spki'" + message: "The 'options.type' property is invalid. Received 'spki'" }); // Unlike SPKI, PKCS#1 is a valid encoding for private keys (and public keys), @@ -472,6 +472,6 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem', }, { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.cipher' is invalid. Received undefined" + message: "The 'options.cipher' property is invalid. Received undefined" }); } diff --git a/test/parallel/test-crypto-keygen.js b/test/parallel/test-crypto-keygen.js index ed4750682d75c2..5b87301af1dbd3 100644 --- a/test/parallel/test-crypto-keygen.js +++ b/test/parallel/test-crypto-keygen.js @@ -559,7 +559,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }), { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.paramEncoding' is invalid. " + + message: "The 'options.paramEncoding' property is invalid. " + "Received 'otherEncoding'" }); } @@ -606,7 +606,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); assert.throws(() => generateKeyPairSync('rsa2', {}), { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The argument 'type' must be a supported key type. Received 'rsa2'" + message: "The 'type' argument must be a supported key type. Received 'rsa2'" }); } @@ -686,7 +686,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }), { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.publicKeyEncoding' is invalid. " + + message: "The 'options.publicKeyEncoding' property is invalid. " + `Received ${inspect(enc)}` }); } @@ -706,7 +706,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }), { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.publicKeyEncoding.type' is invalid. " + + message: "The 'options.publicKeyEncoding.type' property is invalid. " + `Received ${inspect(type)}` }); } @@ -726,7 +726,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }), { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.publicKeyEncoding.format' is invalid. " + + message: "The 'options.publicKeyEncoding.format' property is invalid. " + `Received ${inspect(format)}` }); } @@ -743,7 +743,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }), { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.privateKeyEncoding' is invalid. " + + message: "The 'options.privateKeyEncoding' property is invalid. " + `Received ${inspect(enc)}` }); } @@ -763,7 +763,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }), { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.privateKeyEncoding.type' is invalid. " + + message: "The 'options.privateKeyEncoding.type' property is invalid. " + `Received ${inspect(type)}` }); } @@ -783,7 +783,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }), { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.privateKeyEncoding.format' is invalid. " + + message: "The 'options.privateKeyEncoding.format' property is invalid. " + `Received ${inspect(format)}` }); } @@ -804,7 +804,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }), { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.privateKeyEncoding.cipher' is invalid. " + + message: "The 'options.privateKeyEncoding.cipher' property is invalid. " + `Received ${inspect(cipher)}` }); } @@ -845,7 +845,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }), { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.privateKeyEncoding.passphrase' " + + message: "The 'options.privateKeyEncoding.passphrase' property " + `is invalid. Received ${inspect(passphrase)}` }); } @@ -872,7 +872,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }), { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.modulusLength' is invalid. " + + message: "The 'options.modulusLength' property is invalid. " + `Received ${inspect(modulusLength)}` }); } @@ -885,7 +885,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }), { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.publicExponent' is invalid. " + + message: "The 'options.publicExponent' property is invalid. " + `Received ${inspect(publicExponent)}` }); } @@ -900,7 +900,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }), { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.modulusLength' is invalid. " + + message: "The 'options.modulusLength' property is invalid. " + `Received ${inspect(modulusLength)}` }); } @@ -913,7 +913,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }), { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.divisorLength' is invalid. " + + message: "The 'options.divisorLength' property is invalid. " + `Received ${inspect(divisorLength)}` }); } @@ -944,7 +944,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }, { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.namedCurve' is invalid. " + + message: "The 'options.namedCurve' property is invalid. " + `Received ${inspect(namedCurve)}` }); } @@ -1066,7 +1066,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }, { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.publicKeyEncoding.type' is invalid. " + + message: "The 'options.publicKeyEncoding.type' property is invalid. " + `Received ${inspect(type)}` }); } @@ -1081,7 +1081,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }, { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.hash' is invalid. " + + message: "The 'options.hash' property is invalid. " + `Received ${inspect(hashValue)}` }); } @@ -1097,7 +1097,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }, { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.privateKeyEncoding.type' is invalid. " + + message: "The 'options.privateKeyEncoding.type' property is invalid. " + `Received ${inspect(type)}` }); } @@ -1197,7 +1197,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.mgf1Hash' is invalid. " + + message: "The 'options.mgf1Hash' property is invalid. " + `Received ${inspect(mgf1Hash)}` } diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js index 2313dfef7f594f..7167fa46860854 100644 --- a/test/parallel/test-crypto-sign-verify.js +++ b/test/parallel/test-crypto-sign-verify.js @@ -76,7 +76,7 @@ assert.throws( { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: "The property 'options.padding' is invalid. Received null", + message: "The 'options.padding' property is invalid. Received null", }); assert.throws( @@ -87,7 +87,7 @@ assert.throws( { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: "The property 'options.saltLength' is invalid. Received null", + message: "The 'options.saltLength' property is invalid. Received null", }); // Test signing and verifying diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js index 6b72dbd21cd07d..e7ec54f9028a74 100644 --- a/test/parallel/test-crypto.js +++ b/test/parallel/test-crypto.js @@ -164,7 +164,7 @@ testImmutability(crypto.getCurves); const encodingError = { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: "The argument 'encoding' is invalid for data of length 1." + + message: "The 'encoding' argument is invalid for data of length 1." + " Received 'hex'", }; diff --git a/test/parallel/test-dns-lookup.js b/test/parallel/test-dns-lookup.js index 0885c151a85290..31f99f2dc1b775 100644 --- a/test/parallel/test-dns-lookup.js +++ b/test/parallel/test-dns-lookup.js @@ -54,7 +54,7 @@ assert.throws(() => { const err = { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: "The argument 'hints' is invalid. Received 100" + message: "The 'hints' argument is invalid. Received 100" }; const options = { hints: 100, @@ -72,7 +72,7 @@ assert.throws(() => { const err = { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: "The argument 'family' must be one of: 0, 4, 6. Received 20" + message: "The 'family' argument must be one of: 0, 4, 6. Received 20" }; const options = { hints: 0, diff --git a/test/parallel/test-dns.js b/test/parallel/test-dns.js index fe55685bdc2c8b..79925c0519be68 100644 --- a/test/parallel/test-dns.js +++ b/test/parallel/test-dns.js @@ -220,7 +220,7 @@ assert.deepStrictEqual(dns.getServers(), []); const err = { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: /The argument 'hints' is invalid\. Received \d+/ + message: /The 'hints' argument is invalid\. Received \d+/ }; assert.throws(() => { @@ -296,7 +296,7 @@ dns.lookup('', { const err = { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: `The argument 'address' is invalid. Received '${invalidAddress}'` + message: `The 'address' argument is invalid. Received '${invalidAddress}'` }; assert.throws(() => { diff --git a/test/parallel/test-fs-chmod.js b/test/parallel/test-fs-chmod.js index 36e417c6c4b5e3..940059737c5e12 100644 --- a/test/parallel/test-fs-chmod.js +++ b/test/parallel/test-fs-chmod.js @@ -114,7 +114,7 @@ fs.open(file2, 'w', common.mustCall((err, fd) => { { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: 'The argument \'mode\' must be a 32-bit unsigned integer ' + + message: 'The \'mode\' argument must be a 32-bit unsigned integer ' + 'or an octal string. Received {}' } ); diff --git a/test/parallel/test-fs-fchmod.js b/test/parallel/test-fs-fchmod.js index a6d5c0c95dac1b..36a43430b97575 100644 --- a/test/parallel/test-fs-fchmod.js +++ b/test/parallel/test-fs-fchmod.js @@ -24,7 +24,7 @@ const fs = require('fs'); const errObj = { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: 'The argument \'mode\' must be a 32-bit unsigned integer or an ' + + message: 'The \'mode\' argument must be a 32-bit unsigned integer or an ' + `octal string. Received ${util.inspect(input)}` }; assert.throws(() => fs.fchmod(1, input), errObj); diff --git a/test/parallel/test-fs-lchmod.js b/test/parallel/test-fs-lchmod.js index 0a740b65041faf..214d7dd98d9420 100644 --- a/test/parallel/test-fs-lchmod.js +++ b/test/parallel/test-fs-lchmod.js @@ -42,7 +42,7 @@ assert.throws(() => fs.lchmod(f, {}), { code: 'ERR_INVALID_CALLBACK' }); const errObj = { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: 'The argument \'mode\' must be a 32-bit unsigned integer or an ' + + message: 'The \'mode\' argument must be a 32-bit unsigned integer or an ' + `octal string. Received ${util.inspect(input)}` }; diff --git a/test/parallel/test-fs-open.js b/test/parallel/test-fs-open.js index c96c435c6c33b4..a339360bcefb8a 100644 --- a/test/parallel/test-fs-open.js +++ b/test/parallel/test-fs-open.js @@ -112,21 +112,21 @@ for (const extra of [[], ['r'], ['r', 0], ['r', 0, 'bad callback']]) { assert.throws( () => fs.open(__filename, 'r', mode, common.mustNotCall()), { - message: /'mode' must be a 32-bit/, + message: /'mode' argument must be a 32-bit/, code: 'ERR_INVALID_ARG_VALUE' } ); assert.throws( () => fs.openSync(__filename, 'r', mode, common.mustNotCall()), { - message: /'mode' must be a 32-bit/, + message: /'mode' argument must be a 32-bit/, code: 'ERR_INVALID_ARG_VALUE' } ); assert.rejects( fs.promises.open(__filename, 'r', mode), { - message: /'mode' must be a 32-bit/, + message: /'mode' argument must be a 32-bit/, code: 'ERR_INVALID_ARG_VALUE' } ); diff --git a/test/parallel/test-fs-read-empty-buffer.js b/test/parallel/test-fs-read-empty-buffer.js index 7ec5e5c186f5eb..697fa54b95837e 100644 --- a/test/parallel/test-fs-read-empty-buffer.js +++ b/test/parallel/test-fs-read-empty-buffer.js @@ -14,7 +14,7 @@ assert.throws( () => fs.readSync(fd, buffer, 0, 10, 0), { code: 'ERR_INVALID_ARG_VALUE', - message: 'The argument \'buffer\' is empty and cannot be written. ' + + message: 'The \'buffer\' argument is empty and cannot be written. ' + 'Received Uint8Array(0) []' } ); @@ -23,7 +23,7 @@ assert.throws( () => fs.read(fd, buffer, 0, 1, 0, common.mustNotCall()), { code: 'ERR_INVALID_ARG_VALUE', - message: 'The argument \'buffer\' is empty and cannot be written. ' + + message: 'The \'buffer\' argument is empty and cannot be written. ' + 'Received Uint8Array(0) []' } ); @@ -34,7 +34,7 @@ assert.throws( () => filehandle.read(buffer, 0, 1, 0), { code: 'ERR_INVALID_ARG_VALUE', - message: 'The argument \'buffer\' is empty and cannot be written. ' + + message: 'The \'buffer\' argument is empty and cannot be written. ' + 'Received Uint8Array(0) []' } ); diff --git a/test/parallel/test-fs-whatwg-url.js b/test/parallel/test-fs-whatwg-url.js index f12e3ae37ebadb..566172c37cb23a 100644 --- a/test/parallel/test-fs-whatwg-url.js +++ b/test/parallel/test-fs-whatwg-url.js @@ -62,7 +62,7 @@ if (common.isWindows) { { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: 'The argument \'path\' must be a string or Uint8Array without ' + + message: 'The \'path\' argument must be a string or Uint8Array without ' + "null bytes. Received 'c:\\\\tmp\\\\\\x00test'" } ); @@ -96,7 +96,7 @@ if (common.isWindows) { { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: "The argument 'path' must be a string or Uint8Array without " + + message: "The 'path' argument must be a string or Uint8Array without " + "null bytes. Received '/tmp/\\x00test'" } ); diff --git a/test/parallel/test-http-agent-scheduling.js b/test/parallel/test-http-agent-scheduling.js index b5ed2df4363a55..725416dfa225bf 100644 --- a/test/parallel/test-http-agent-scheduling.js +++ b/test/parallel/test-http-agent-scheduling.js @@ -137,7 +137,7 @@ function badSchedulingOptionTest() { assert.strictEqual(err.code, 'ERR_INVALID_ARG_VALUE'); assert.strictEqual( err.message, - "The argument 'scheduling' must be one of: 'fifo', 'lifo'. " + + "The 'scheduling' argument must be one of: 'fifo', 'lifo'. " + "Received 'filo'" ); } diff --git a/test/parallel/test-http2-client-request-options-errors.js b/test/parallel/test-http2-client-request-options-errors.js index f2950fe4d287b4..f32ffa00220889 100644 --- a/test/parallel/test-http2-client-request-options-errors.js +++ b/test/parallel/test-http2-client-request-options-errors.js @@ -49,7 +49,7 @@ server.listen(0, common.mustCall(() => { }), { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: `The property 'options.${option}' is invalid. ` + + message: `The 'options.${option}' property is invalid. ` + `Received ${inspect(types[type])}` }); }); diff --git a/test/parallel/test-http2-compat-serverrequest-headers.js b/test/parallel/test-http2-compat-serverrequest-headers.js index 06f37c8a47ce19..a3f80a5ad0c101 100644 --- a/test/parallel/test-http2-compat-serverrequest-headers.js +++ b/test/parallel/test-http2-compat-serverrequest-headers.js @@ -50,7 +50,7 @@ server.listen(0, common.mustCall(function() { { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: "The argument 'method' is invalid. Received ' '" + message: "The 'method' argument is invalid. Received ' '" } ); assert.throws( diff --git a/test/parallel/test-http2-respond-file-errors.js b/test/parallel/test-http2-respond-file-errors.js index 5c3424f2bc3484..a7d03d5ba5aaa9 100644 --- a/test/parallel/test-http2-respond-file-errors.js +++ b/test/parallel/test-http2-respond-file-errors.js @@ -46,7 +46,7 @@ server.on('stream', common.mustCall((stream) => { { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: `The property 'options.${option}' is invalid. ` + + message: `The 'options.${option}' property is invalid. ` + `Received ${inspect(types[type])}` } ); diff --git a/test/parallel/test-http2-respond-file-fd-errors.js b/test/parallel/test-http2-respond-file-fd-errors.js index 5f7e57ea4e45d2..5ee8e123baa712 100644 --- a/test/parallel/test-http2-respond-file-fd-errors.js +++ b/test/parallel/test-http2-respond-file-fd-errors.js @@ -66,7 +66,7 @@ server.on('stream', common.mustCall((stream) => { { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: `The property 'options.${option}' is invalid. ` + + message: `The 'options.${option}' property is invalid. ` + `Received ${inspect(types[type])}` } ); diff --git a/test/parallel/test-internal-validators-validateoneof.js b/test/parallel/test-internal-validators-validateoneof.js index 5c5a62ef893726..5ec99da2acbc45 100644 --- a/test/parallel/test-internal-validators-validateoneof.js +++ b/test/parallel/test-internal-validators-validateoneof.js @@ -11,7 +11,7 @@ const { validateOneOf } = require('internal/validators'); assert.throws(() => validateOneOf(1, 'name', allowed), { code: 'ERR_INVALID_ARG_VALUE', // eslint-disable-next-line quotes - message: `The argument 'name' must be one of: 2, 3. Received 1` + message: `The 'name' argument must be one of: 2, 3. Received 1` }); } @@ -26,7 +26,7 @@ const { validateOneOf } = require('internal/validators'); assert.throws(() => validateOneOf('a', 'name', allowed), { code: 'ERR_INVALID_ARG_VALUE', // eslint-disable-next-line quotes - message: `The argument 'name' must be one of: 'b', 'c'. Received 'a'` + message: `The 'name' argument must be one of: 'b', 'c'. Received 'a'` }); } @@ -41,7 +41,7 @@ const { validateOneOf } = require('internal/validators'); assert.throws(() => validateOneOf(Symbol.for('a'), 'name', allowed), { code: 'ERR_INVALID_ARG_VALUE', // eslint-disable-next-line quotes - message: `The argument 'name' must be one of: Symbol(b), Symbol(c). ` + + message: `The 'name' argument must be one of: Symbol(b), Symbol(c). ` + 'Received Symbol(a)' }); } diff --git a/test/parallel/test-module-create-require.js b/test/parallel/test-module-create-require.js index fc7c8b3fc697ea..753e08c337a32c 100644 --- a/test/parallel/test-module-create-require.js +++ b/test/parallel/test-module-create-require.js @@ -31,6 +31,6 @@ assert.throws(() => { createRequire({}); }, { code: 'ERR_INVALID_ARG_VALUE', - message: 'The argument \'filename\' must be a file URL object, file URL ' + + message: 'The \'filename\' argument must be a file URL object, file URL ' + 'string, or absolute path string. Received {}' }); diff --git a/test/parallel/test-module-loading-error.js b/test/parallel/test-module-loading-error.js index 5bc01ce52d7279..cac0a3f0608bf0 100644 --- a/test/parallel/test-module-loading-error.js +++ b/test/parallel/test-module-loading-error.js @@ -81,7 +81,7 @@ assert.throws( { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: 'The argument \'id\' must be a non-empty string. Received \'\'' + message: 'The \'id\' argument must be a non-empty string. Received \'\'' }); assert.throws( diff --git a/test/parallel/test-net-connect-options-port.js b/test/parallel/test-net-connect-options-port.js index 74e78240abb5ba..439e5ebda4fce3 100644 --- a/test/parallel/test-net-connect-options-port.js +++ b/test/parallel/test-net-connect-options-port.js @@ -66,7 +66,7 @@ const net = require('net'); assert.throws(fn, { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: /The argument 'hints' is invalid\. Received \d+/ + message: /The 'hints' argument is invalid\. Received \d+/ }); } } diff --git a/test/parallel/test-net-server-listen-options.js b/test/parallel/test-net-server-listen-options.js index 336485a3cb8f55..8966009a341af2 100644 --- a/test/parallel/test-net-server-listen-options.js +++ b/test/parallel/test-net-server-listen-options.js @@ -64,14 +64,14 @@ const listenOnPort = [ { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: /^The argument 'options' must have the property "port" or "path"\. Received .+$/, + message: /^The 'options' argument must have the property "port" or "path"\. Received .+$/, }); } else { assert.throws(fn, { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: /^The argument 'options' is invalid\. Received .+$/, + message: /^The 'options' argument is invalid\. Received .+$/, }); } } diff --git a/test/parallel/test-performanceobserver.js b/test/parallel/test-performanceobserver.js index 8c4c1bbc9f774e..91e5add3ab2be2 100644 --- a/test/parallel/test-performanceobserver.js +++ b/test/parallel/test-performanceobserver.js @@ -58,7 +58,7 @@ assert.strictEqual(counts[NODE_PERFORMANCE_ENTRY_TYPE_FUNCTION], 0); { code: 'ERR_INVALID_ARG_VALUE', name: 'TypeError', - message: "The property 'options.entryTypes' is invalid. " + + message: "The 'options.entryTypes' property is invalid. " + `Received ${inspect(i)}` }); }); diff --git a/test/parallel/test-process-cpuUsage.js b/test/parallel/test-process-cpuUsage.js index ecff499fd7e037..7ff852193d1165 100644 --- a/test/parallel/test-process-cpuUsage.js +++ b/test/parallel/test-process-cpuUsage.js @@ -85,7 +85,7 @@ assert.throws( { code: 'ERR_INVALID_ARG_VALUE', name: 'RangeError', - message: "The property 'prevValue.user' is invalid. " + + message: "The 'prevValue.user' property is invalid. " + `Received ${value.user}`, } ); @@ -100,7 +100,7 @@ assert.throws( { code: 'ERR_INVALID_ARG_VALUE', name: 'RangeError', - message: "The property 'prevValue.system' is invalid. " + + message: "The 'prevValue.system' property is invalid. " + `Received ${value.system}`, } ); diff --git a/test/parallel/test-process-umask.js b/test/parallel/test-process-umask.js index e74c71e1935246..77ccfa5f832a53 100644 --- a/test/parallel/test-process-umask.js +++ b/test/parallel/test-process-umask.js @@ -61,7 +61,7 @@ assert.throws(() => { process.umask({}); }, { code: 'ERR_INVALID_ARG_VALUE', - message: 'The argument \'mask\' must be a 32-bit unsigned integer ' + + message: 'The \'mask\' argument must be a 32-bit unsigned integer ' + 'or an octal string. Received {}' }); @@ -70,7 +70,7 @@ assert.throws(() => { process.umask(value); }, { code: 'ERR_INVALID_ARG_VALUE', - message: 'The argument \'mask\' must be a 32-bit unsigned integer ' + + message: 'The \'mask\' argument must be a 32-bit unsigned integer ' + `or an octal string. Received '${value}'` }); }); diff --git a/test/parallel/test-stream-transform-split-highwatermark.js b/test/parallel/test-stream-transform-split-highwatermark.js index 22d13fd3c3b0e3..091cdb159991f1 100644 --- a/test/parallel/test-stream-transform-split-highwatermark.js +++ b/test/parallel/test-stream-transform-split-highwatermark.js @@ -69,7 +69,7 @@ testTransform(0, 0, { }, { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.readableHighWaterMark' is invalid. " + + message: "The 'options.readableHighWaterMark' property is invalid. " + 'Received NaN' }); @@ -78,7 +78,7 @@ testTransform(0, 0, { }, { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.writableHighWaterMark' is invalid. " + + message: "The 'options.writableHighWaterMark' property is invalid. " + 'Received NaN' }); } diff --git a/test/parallel/test-streams-highwatermark.js b/test/parallel/test-streams-highwatermark.js index 7d13be2dd19077..937f7915aed3e7 100644 --- a/test/parallel/test-streams-highwatermark.js +++ b/test/parallel/test-streams-highwatermark.js @@ -27,7 +27,7 @@ const { inspect } = require('util'); }, { name: 'TypeError', code: 'ERR_INVALID_ARG_VALUE', - message: "The property 'options.highWaterMark' is invalid. " + + message: "The 'options.highWaterMark' property is invalid. " + `Received ${inspect(invalidHwm)}` }); } diff --git a/test/parallel/test-vm-module-basic.js b/test/parallel/test-vm-module-basic.js index 0376473bf7123c..8ff2da981a6343 100644 --- a/test/parallel/test-vm-module-basic.js +++ b/test/parallel/test-vm-module-basic.js @@ -138,7 +138,7 @@ const util = require('util'); // https://github.com/nodejs/node/issues/32806 { assert.throws(() => new SyntheticModule(['x', 'x'], () => {}, {}), { - message: 'The property \'exportNames.x\' is duplicated. Received \'x\'', + message: 'The \'exportNames.x\' property is duplicated. Received \'x\'', name: 'TypeError', }); } diff --git a/test/parallel/test-worker-unsupported-eval-on-url.mjs b/test/parallel/test-worker-unsupported-eval-on-url.mjs index d5ff6a8548d2de..53a704c8889fcb 100644 --- a/test/parallel/test-worker-unsupported-eval-on-url.mjs +++ b/test/parallel/test-worker-unsupported-eval-on-url.mjs @@ -2,5 +2,5 @@ import '../common/index.mjs'; import assert from 'assert'; import { Worker } from 'worker_threads'; -const re = /The property 'options\.eval' must be false when 'filename' is not a string\./; +const re = /The 'options\.eval' property must be false when 'filename' is not a string\./; assert.throws(() => new Worker(new URL(import.meta.url), { eval: true }), re);