summaryrefslogtreecommitdiff
path: root/test/parallel/test-event-emitter-errors.js
Commit message (Collapse)AuthorAgeFilesLines
* test: add trailing commas in event testsRich Trott2022-11-221-4/+4
| | | | | | | | | | | As much as I would like to do this everywhere and then modify the lint rule to enforce it, the churn would be too big. However if we're going to have relatively frequent nits for this sort of thing (as we do), I'd prefer we migrate a few files at a time to never actually getting around to doing it. Ref: https://github.com/nodejs/node/pull/45448#pullrequestreview-1179370442 PR-URL: https://github.com/nodejs/node/pull/45466 Reviewed-By: James M Snell <jasnell@gmail.com>
* test: refactor common.expectsErrorRuben Bridgewater2019-12-311-7/+8
| | | | | | | | | | | | | | | | | | | | | | | 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>
* events: show inspected error in uncaught 'error' messageAnna Henningsen2019-01-231-1/+14
| | | | | | | | | | | | | | | | If there is no handler for `.emit('error', value)` and `value` is not an `Error` object, we currently just call `.toString()` on it. Almost always, using `util.inspect()` provides better information for diagnostic purposes, so prefer to use that instead. Refs: https://github.com/nodejs/help/issues/1729 PR-URL: https://github.com/nodejs/node/pull/25621 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matheus Marchini <mat@mmarchini.me>
* events: migrate to internal/errorsJames M Snell2017-10-131-8/+17
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/15623 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
* lib,src: fix consistent spacing inside bracesSebastiaan Deckers2017-07-211-1/+1
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/14162 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* events: update and clarify error messageChris Burkhart2017-03-241-2/+6
| | | | | | | | | | | | | Update error message that's thrown when no error listeners are attached to an emitter. PR-URL: https://github.com/nodejs/node/pull/10387 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
* test: use eslint to fix var->const/letGibson Fahnestock2017-01-111-1/+1
| | | | | | | | | Manually fix issues that eslint --fix couldn't do automatically. PR-URL: https://github.com/nodejs/node/pull/10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
* test: use const for all require() callscjihrig2017-01-021-2/+2
| | | | | PR-URL: https://github.com/nodejs/node/pull/10550 Reviewed-By: Rich Trott <rtrott@gmail.com>
* test: load common.js to test for global leaksRich Trott2015-10-011-0/+1
| | | | | | | | | | common.js contains code that checks for variables leaking into the global namespace. Load common.js in all tests that do not intentionally leak variables. PR-URL: https://github.com/nodejs/node/pull/3095 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
* test: enable linting for testsRoman Reiss2015-05-191-0/+1
| | | | | | | | | | | | Enable linting for the test directory. A number of changes was made so all tests conform the current rules used by lib and src directories. The only exception for tests is that unreachable (dead) code is allowed. test-fs-non-number-arguments-throw had to be excluded from the changes because of a weird issue on Windows CI. PR-URL: https://github.com/nodejs/io.js/pull/1721 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* events: provide better error message for unhandled errorEvan Lucas2015-05-121-0/+8
Previously, in the event of an unhandled error event, if the error is a not an actual Error, then a default error is thrown. Now, the argument is appended to the error message and added as the `context` property of the error. PR-URL: https://github.com/iojs/io.js/pull/1654 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>