summaryrefslogtreecommitdiff
path: root/test/parallel/test-tls-options-boolean-check.js
Commit message (Collapse)AuthorAgeFilesLines
* test: prepare for consistent comma-dangle lint ruleRich Trott2021-04-011-5/+5
| | | | | | | | | Make changes so that tests will pass when the comma-dangle settings applied to the rest of the code base are also applied to tests. PR-URL: https://github.com/nodejs/node/pull/37930 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
* test: refactor common.expectsErrorRuben Bridgewater2019-12-311-6/+7
| | | | | | | | | | | | | | | | | | | | | | | This completely refactors the `expectsError` behavior: so far it's almost identical to `assert.throws(fn, object)` in case it was used with a function as first argument. It had a magical property check that allowed to verify a functions `type` in case `type` was passed used in the validation object. This pattern is now completely removed and `assert.throws()` should be used instead. The main intent for `common.expectsError()` is to verify error cases for callback based APIs. This is now more flexible by accepting all validation possibilites that `assert.throws()` accepts as well. No magical properties exist anymore. This reduces surprising behavior for developers who are not used to the Node.js core code base. This has the side effect that `common` is used significantly less frequent. PR-URL: https://github.com/nodejs/node/pull/31092 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
* errors: improve ERR_INVALID_ARG_TYPERuben Bridgewater2019-12-201-11/+14
| | | | | | | | | | | | | | ERR_INVALID_ARG_TYPE is the most common error used throughout the code base. This improves the error message by providing more details to the user and by indicating more precisely which values are allowed ones and which ones are not. It adds the actual input to the error message in case it's a primitive. If it's a class instance, it'll print the class name instead of "object" and "falsy" or similar entries are not named "type" anymore. PR-URL: https://github.com/nodejs/node/pull/29675 Reviewed-By: Rich Trott <rtrott@gmail.com>
* tls: specify options.name in validateKeyCertDaniel Bevenius2018-04-271-4/+4
| | | | | | | | | | | | | | | | This commit addresses a TODO added by Ruben Bridgewater in commit c6b6c92185316e13738e6fa931fdd5303e381e46 ("lib: always show ERR_INVALID_ARG_TYPE received part") which was to prefix the name of the invalid argument with 'options.'. This commit also switches the order of the parameters to validateKeyCert to be consistent with other validators. PR-URL: https://github.com/nodejs/node/pull/20284 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
* lib: always show ERR_INVALID_ARG_TYPE received partRuben Bridgewater2018-03-251-49/+45
| | | | | | | | | | | | | | 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>
* test: remove assert.doesNotThrow()Ruben Bridgewater2018-02-161-10/+3
| | | | | | | | | | | | | There is actually no reason to use `assert.doesNotThrow()` in the tests. If a test throws, just let the error bubble up right away instead of first catching it and then rethrowing it. PR-URL: https://github.com/nodejs/node/pull/18669 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
* test: replace map() with forEach() where appropriateRich Trott2017-12-281-6/+6
| | | | | | | | | | | | | | | Two tests were using Array.prototype.map() without returning values in the callback. In other words, they were using it where a `.forEach()` was called for. Change to `.forEach()`. PR-URL: https://github.com/nodejs/node/pull/17858 Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
* test: replace assert.throws w/ common.expectsErrorMithun Sasidharan2017-12-081-9/+9
| | | | | | PR-URL: https://github.com/nodejs/node/pull/17498 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
* tls: re-allow falsey option valuesAnna Henningsen2017-09-051-23/+41
| | | | | | | | | | | | | | | | | | | | | 5723c4c5f06f138 was an unintentional breaking change in that it changed the behaviour of `tls.createSecureContext()` to throw on false-y input rather than ignoring it. This breaks real-world applications like `npm`. This restores the previous behaviour. PR-URL: https://github.com/nodejs/node/pull/15131 Ref: https://github.com/nodejs/node/pull/15053 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: MichaƫZasso <targos@protonmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
* tls: type checking for `key`, `cert` and `ca` optionsJimmy Cann2017-08-271-0/+156
PR-URL: https://github.com/nodejs/node/pull/14807 Fixes: https://github.com/nodejs/node/issues/12802 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>