aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-http2-createsecureserver-nooptions.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2018-03-19 13:33:46 +0100
committerRuben Bridgewater <ruben@bridgewater.de>2018-03-25 01:45:37 +0100
commitc6b6c92185316e13738e6fa931fdd5303e381e46 (patch)
treec38af9cd1a0a8cd6eeb459af3adee4dfd390fdc6 /test/parallel/test-http2-createsecureserver-nooptions.js
parenteeb57022e6bada13955a19b15232a9ee4fe9b465 (diff)
downloadandroid-node-v8-c6b6c92185316e13738e6fa931fdd5303e381e46.tar.gz
android-node-v8-c6b6c92185316e13738e6fa931fdd5303e381e46.tar.bz2
android-node-v8-c6b6c92185316e13738e6fa931fdd5303e381e46.zip
lib: always show ERR_INVALID_ARG_TYPE received part
This makes a effort to make sure all of these errors will actually also show the received input. On top of that it refactors a few tests for better maintainability. It will also change the returned type to always be a simple typeof instead of special handling null. PR-URL: https://github.com/nodejs/node/pull/19445 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'test/parallel/test-http2-createsecureserver-nooptions.js')
-rw-r--r--test/parallel/test-http2-createsecureserver-nooptions.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/parallel/test-http2-createsecureserver-nooptions.js b/test/parallel/test-http2-createsecureserver-nooptions.js
index 71764f5783..767797febc 100644
--- a/test/parallel/test-http2-createsecureserver-nooptions.js
+++ b/test/parallel/test-http2-createsecureserver-nooptions.js
@@ -4,19 +4,19 @@ const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
+const assert = require('assert');
const http2 = require('http2');
-const invalidOptions = [() => {}, 1, 'test', null];
-const invalidArgTypeError = {
- type: TypeError,
- code: 'ERR_INVALID_ARG_TYPE',
- message: 'The "options" argument must be of type Object'
-};
-
// Error if options are not passed to createSecureServer
+const invalidOptions = [() => {}, 1, 'test', null];
invalidOptions.forEach((invalidOption) => {
- common.expectsError(
+ assert.throws(
() => http2.createSecureServer(invalidOption),
- invalidArgTypeError
+ {
+ name: 'TypeError [ERR_INVALID_ARG_TYPE]',
+ code: 'ERR_INVALID_ARG_TYPE',
+ message: 'The "options" argument must be of type Object. Received ' +
+ `type ${typeof invalidOption}`
+ }
);
});