summaryrefslogtreecommitdiff
path: root/doc/api/assert.md
AgeCommit message (Collapse)Author
2019-01-27assert: adjust loose assertionsRuben Bridgewater
This changes the loose deep equal comparison by using the same logic as done in the strict deep equal comparison besides comparing primitives loosely, not comparing symbol properties and not comparing the prototype. `assert.deepEqual` is still commenly used and this is likely the biggest pitfall. Most changes are only minor and won't have a big impact besides likely fixing user expectations. PR-URL: https://github.com/nodejs/node/pull/25008 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2018-11-28doc: sort bottom-of-file markdown linksSam Roberts
Reapply https://github.com/nodejs/node/pull/12726 It would be nice to have the sort check applied as part of doc testing, but this change doesn't implement that. PR-URL: https://github.com/nodejs/node/pull/24679 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-10-29doc: remove notice of dashes in V8 optionsDenys Otrishko
Previously only V8 options supported both dashes in them (making them equivalent), but now Node.js also supports both styles so the note can be removed. PR-URL: https://github.com/nodejs/node/pull/23903 Refs: https://github.com/nodejs/node/pull/18592 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: George Adams <george.adams@uk.ibm.com>
2018-09-07doc: improve assert documentationRuben Bridgewater
This fixes the officially accepted message types for `assert.throws()`, `assert.rejects()`, `assert.doesNotThrow()` and `assert.doesNotReject()`. It also renames the `block` argument in those functions to `fn` and `promiseFn` for further clarity. PR-URL: https://github.com/nodejs/node/pull/22692 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: George Adams <george.adams@uk.ibm.com>
2018-08-29doc: remove redundant 'Example:' and similar notesVse Mozhet Byt
Some nits were also fixed in passing. PR-URL: https://github.com/nodejs/node/pull/22537 Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-08-04assert: multiple improvementsRuben Bridgewater
1) Switched + / - and red / green in diffs. It seems like that style is more natural to most people. 2) Short primitives do not use the diff anymore. Especially short numbers can be read well like 1 !== 2. Cases that can not be displayed like that (e.g., -0 and +0) use the regular diff output. 3) Improved error descriptions. It was not always clear what the messages stood for. That should now be resolved. 4) Added a position indicator for single lines in case a tty is used and the line is shorter than the visual columns. 5) Color detection is now done by checking stderr instead of stdout. PR-URL: https://github.com/nodejs/node/pull/21628 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2018-08-02doc: rename stackStartFunction in assert.mdEugene Y. Q. Shen
[assert.js](https://github.com/nodejs/node/blob/master/lib/assert.js) uses `stackStartFn` everywhere instead of `stackStartFunction`. This also increases consistency with `stackStartFn` in the `AssertionError` options. PR-URL: https://github.com/nodejs/node/pull/22077 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-06-06doc: remove spaces around slashesRich Trott
Remove spaces around slash characters in documentation. This change sometimes rewords the content where the slash construction may not be what is called for. PR-URL: https://github.com/nodejs/node/pull/21140 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-05-232018-05-23, Version 10.2.0 (Current)Anna Henningsen
* addons: - Fixed a memory leak for users of `AsyncResource` and N-API. (Michael Dawson) https://github.com/nodejs/node/pull/20668 * assert: - The `error` parameter of `assert.throws()` can be an object containing regular expressions now. (Ruben Bridgewater) https://github.com/nodejs/node/pull/20485 * crypto: - The `authTagLength` option has been made more flexible (Tobias Nießen) https://github.com/nodejs/node/pull/20235) https://github.com/nodejs/node/pull/20039 * esm: - Builtin modules (e.g. `fs`) now provide named exports in ES6 modules. (Gus Caplan) https://github.com/nodejs/node/pull/20403 * http: - Handling of `close` and `aborted` events has been made more consistent. (Robert Nagy) https://github.com/nodejs/node/pull/20075 https://github.com/nodejs/node/pull/20611 * module: - add --preserve-symlinks-main (David Goldstein) https://github.com/nodejs/node/pull/19911 * timers: - `timeout.refresh()` has been added to the public API. (Jeremiah Senkpiel) https://github.com/nodejs/node/pull/20298 * Embedder support: - Functions for creating V8 `Isolate` and `Context` objects with Node.js-specific behaviour have been added to the API. (Allen Yonghuang Wang) https://github.com/nodejs/node/pull/20639 - Node.js `Environment`s clean up resources before exiting now. (Anna Henningsen) https://github.com/nodejs/node/pull/19377 - Support for multi-threaded embedding has been improved. (Anna Henningsen) https://github.com/nodejs/node/pull/20542 https://github.com/nodejs/node/pull/20539 https://github.com/nodejs/node/pull/20541 PR-URL: https://github.com/nodejs/node/pull/20724
2018-05-14doc: add missing `changes:` entry for assert.throwsAnna Henningsen
Refs: https://github.com/nodejs/node/pull/20485 PR-URL: https://github.com/nodejs/node/pull/20723 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
2018-05-10doc: update assert documentationRuben Bridgewater
This adds concrete expected types to the assert documentation. It also fixes a `changes` entry and improves some minor comments. PR-URL: https://github.com/nodejs/node/pull/20486 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-05-10assert: accept regular expressions to validateRuben Bridgewater
This makes sure regular expressions on validation objects validate against strings when used with `assert.throws` and `assert.rejects`. PR-URL: https://github.com/nodejs/node/pull/20485 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
2018-05-03doc: add more missing backticksVse Mozhet Byt
Also, fix some other nits in passing (formatting, punctuation, typos, redundancy, obsoleteness). PR-URL: https://github.com/nodejs/node/pull/20438 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-04-29doc: improve assert docsRuben Bridgewater
This improves the error example output by reflecting the current state. It also makes sure the examples are up to date in general. `assert.throws` clarified the `ERR_AMBIGUOUS_ARGUMENT` error. PR-URL: https://github.com/nodejs/node/pull/20313 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-04-242018-04-24, Version 10.0.0 (Current)James M Snell
* Assert * Calling `assert.fail()` with more than one argument is deprecated. #70dcacd710 * Calling `assert.ok()` with no arguments will now throw. #3cd7977a42 * Calling `assert.ifError()` will now throw with any argument other than `undefined` or `null`. Previously the method would throw with any truthy value. #e65a6e81ef * The `assert.rejects()` and `assert.doesNotReject()` methods have been added for working with async functions. #599337f43e * Async_hooks * Older experimental async_hooks APIs have been removed. #1cc6b993b9 * Buffer * Uses of `new Buffer()` and `Buffer()` outside of the `node_modules` directory will now emit a runtime deprecation warning. #9d4ab90117 * `Buffer.isEncoding()` now returns `undefined` for falsy values, including an empty string. #452eed956e * `Buffer.fill()` will throw if an attempt is made to fill with an empty `Buffer`. #1e802539b2 * Child Process * Undefined properties of env are ignored. #38ee25e2e2, #85739b6c5b * Console * The `console.table()` method has been added. #97ace04492 * Crypto * The `crypto.createCipher()` and `crypto.createDecipher()` methods have been deprecated. Please use `crypto.createCipheriv()` and `crypto.createDecipheriv()` instead. #81f88e30dd * The `decipher.finaltol()` method has been deprecated. #19f3927d92 * The `crypto.DEFAULT_ENCODING` property has been deprecated. #6035beea93 * The `ECDH.convertKey()` method has been added. #f2e02883e7 * The `crypto.fips` property has been deprecated. #6e7992e8b8 * Dependencies * V8 has been updated to 6.6. #9daebb48d6 * OpenSSL has been updated to 1.1.0h. #66cb29e646 * EventEmitter * The `EventEmitter.prototype.off()` method has been added as an alias for `EventEmitter.prototype.removeListener()`. #3bb6f07d52 * File System * The `fs.promises` API provides experimental promisified versions of the `fs` functions. #329fc78e49 * Invalid path errors are now thrown synchronously. #d8f73385e2 * The `fs.readFile()` method now partitions reads to avoid thread pool exhaustion. #67a4ce1c6e * HTTP * Processing of HTTP Status codes `100`, `102-199` has been improved. #baf8495078 * Multi-byte characters in URL paths are now forbidden. #b961d9fd83 * N-API * The n-api is no longer experimental. #cd7d7b15c1 * Net * The `'close'` event will be emitted after `'end'`. #9b7a6914a7 * Perf_hooks * The `PerformanceObserver` class is now an `AsyncResource` and can be monitored using `async_hooks`. #009e41826f * Trace events are now emitted for performance events. #9e509b622b * The `performance` API has been simplified. #2ec6995555 * Performance milestone marks will be emitted as trace events. #96cb4fb795 * Process * Using non-string values for `process.env` is deprecated. #5826fe4e79 * The `process.assert()` method is deprecated. #703e37cf3f * REPL * REPL now experimentally supports top-level await when using the `--experimental-repl-await` flag. #eeab7bc068 * The previously deprecated "magic mode" has been removed. #4893f70d12 * The previously deprecated `NODE_REPL_HISTORY_FILE` environment variable has been removed. #60c9ad7979 * Proxy objects are shown as Proxy objects when inspected. #90a43906ab * Streams * The `'readable'` event is now always deferred with nextTick. #1e0f3315c7 * A new `pipeline()` method has been provided for building end-to-data stream pipelines. #a5cf3feaf1 * Experimental support for async for-await has been added to `stream.Readable`. #61b4d60c5d * Timers * The `enroll()` and `unenroll()` methods have been deprecated. #68783ae0b8 * TLS * The `tls.convertNONProtocols()` method has been deprecated. #9204a0db6e * Support for NPN (next protocol negotiation) has been dropped. #5bfbe5ceae * The `ecdhCurve` default is now `'auto'`. #af78840b19 * Trace Events * A new `trace_events` top-level module allows trace event categories to be enabled/disabld at runtime. #da5d818a54 * URL * The WHATWG URL API is now a global. #312414662b * Util * `util.types.is[…]` type checks have been added. #b20af8088a * Support for bigint formatting has been added to `util.inspect()`. #39dc947409
2018-04-20assert: validate the block return typeRuben Bridgewater
This makes sure the returned value when calling `block` is actually of type promise in case `assert.rejects` or `assert.doesNotReject` is called. PR-URL: https://github.com/nodejs/node/pull/19886 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2018-04-16doc: improve assert documentationRuben Bridgewater
This adds a example to `assert.throws` to document checking against error instances. It also makes it clearer what some arguments can receive as input. PR-URL: https://github.com/nodejs/node/pull/19885 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-04-16assert: add direct promises support in rejectsRuben Bridgewater
This adds direct promise support to `assert.rejects` and `assert.doesNotReject`. It will now accept both, functions and ES2015 promises as input. Besides this the documentation was updated to reflect the latest changes. It also refactors the tests to a non blocking way to improve the execution performance and improves the coverage. PR-URL: https://github.com/nodejs/node/pull/19885 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-04-11doc: add quotes for event names + fix similar nitsVse Mozhet Byt
PR-URL: https://github.com/nodejs/node/pull/19915 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-04-04doc: fix added value for `assert` moduleRuben Bridgewater
PR-URL: https://github.com/nodejs/node/pull/19724 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-04-04doc: properly document AssertionErrorRuben Bridgewater
The AssertionError was always exposed but never properly documented. This explains how it is used and what options it accepts. PR-URL: https://github.com/nodejs/node/pull/19724 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-04-04doc,tools: formalize, unify, codify default valuesVse Mozhet Byt
PR-URL: https://github.com/nodejs/node/pull/19737 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-04-01tools: add 'spaced-comment' into eslint rulesWeijia Wang
PR-URL: https://github.com/nodejs/node/pull/19596 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-03-27doc: improve assert legacy textRich Trott
This changes a sentence fragment into a full sentence and provides a few other minor improvements. PR-URL: https://github.com/nodejs/node/pull/19622 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-03-24assert: add warning about `assert.doesNotReject`Ruben Bridgewater
The usefulness of `assert.doesNotReject` is very limited and this warns against the usage. PR-URL: https://github.com/nodejs/node/pull/19462 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-03-212018-03-21, Version 9.9.0 (Current)Myles Borins
Notable changes: * assert: - From now on all error messages produced by `assert` in strict mode will produce a error diff. (Ruben Bridgewater) https://github.com/nodejs/node/pull/17615 - From now on it is possible to use a validation object in throws instead of the other possibilities. (Ruben Bridgewater) https://github.com/nodejs/node/pull/17584 * crypto: - allow passing null as IV unless required (Tobias Nießen) https://github.com/nodejs/node/pull/18644 * fs: - support as and as+ flags in stringToFlags() (Sarat Addepalli) https://github.com/nodejs/node/pull/18801 * tls: - expose Finished messages in TLSSocket (Anton Salikhmetov) https://github.com/nodejs/node/pull/19102 * tty: - Add getColorDepth function to determine if terminal supports colors (Ruben Bridgewater) https://github.com/nodejs/node/pull/17615 * util: - add util.inspect compact option (Ruben Bridgewater) https://github.com/nodejs/node/pull/17576 * **Added new collaborators** - [watson](https://github.com/watson) Thomas Watson PR-URL: https://github.com/nodejs/node/pull/19428
2018-03-11doc: fix some recent nits in assert.mdVse Mozhet Byt
* add missing bottom reference * fix possible typos * fix ABC-order in references and sections PR-URL: https://github.com/nodejs/node/pull/19284 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-03-11assert: add rejects() and doesNotReject()feugy
Implement asynchronous equivalent for assert.throws() and assert.doesNotThrow(). PR-URL: https://github.com/nodejs/node/pull/18023 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-03-11doc: add warning to assert.doesNotThrow()Ruben Bridgewater
Using `assert.doesNotThrow()` has no benefit over adding a comment next to some code that should not throw. Therefore it is from now on discouraged to use it. PR-URL: https://github.com/nodejs/node/pull/18699 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-02-23doc: add new documentation lint ruleestrada9166
Add 80 characters limit to docs. Change docs to fit 80 characters per row. PR-URL: https://github.com/nodejs/node/pull/18726 Fixes: https://github.com/nodejs/node/issues/18703 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2018-02-16tools: add assert.doesNotThrow eslint ruleRuben Bridgewater
Prohibit the usage of `assert.doesNotThrow()`. 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>
2018-02-09doc: fix links in YAML metadata of assert.mdVse Mozhet Byt
PR-URL: https://github.com/nodejs/node/pull/18670 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-02-08doc: fix MDN links to avoid redirectionsVse Mozhet Byt
developer.mozilla.org/en/... -> developer.mozilla.org/en-US/... PR-URL: https://github.com/nodejs/node/pull/18631 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2018-02-04doc: fix `REPLACEME` in changelog PR URLsAnna Henningsen
PR-URL: https://github.com/nodejs/node/pull/18561 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
2018-02-02assert: deprecate assert.fail partiallyRuben Bridgewater
Using `assert.fail()` with more than one argument is not intuitive to use and has no benefit over using a message on its own. Therefore this introduces a runtime deprecation in case it is used in that way. PR-URL: https://github.com/nodejs/node/pull/18418 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-02-01doc: document asserts Weak(Map|Set) behaviorRuben Bridgewater
Right now it is not documentated that WeakMap entries are not compared. This might result in some confusion. This adds a note about the behavior in `assert.deepStrictEqual`. This documentation is also references in `util.isDeepStrictEqual`, so we do not have to document it again for that function as the underlying algorithm is the same. PR-URL: https://github.com/nodejs/node/pull/18248 Fixes: https://github.com/nodejs/node/issues/18228 Refs: https://github.com/nodejs/node/pull/18228 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-02-01assert: use a default message in assertRuben Bridgewater
In case no arguments are passed to `assert.ok` it should just use a default message. Otherwise `assert.ok` can not be used as a callback. PR-URL: https://github.com/nodejs/node/pull/18319 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2018-01-24assert: stricter ifErrorRuben Bridgewater
This makes `assert.ifError` stricter by only accepting `null` and `undefined` from now on. Before any truthy value was accepted. PR-URL: https://github.com/nodejs/node/pull/18247 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-01-24assert: wrap original error in ifErrorRuben Bridgewater
It is hard to know where ifError is actually triggered due to the original error being thrown. This changes it by wrapping the original error in a AssertionError. This has the positive effect of also making clear that it is indeed a assertion function that triggered that error. The original stack can still be accessed by checking the `actual` property. PR-URL: https://github.com/nodejs/node/pull/18247 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-01-24tty: add getColorDepth functionRuben Bridgewater
Right now it is very difficult to determine if a terminal supports colors or not. This function adds this functionality by detecting environment variables and checking process. PR-URL: https://github.com/nodejs/node/pull/17615 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-01-24assert: improve error messagesRuben Bridgewater
From now on all error messages produced by `assert` in strict mode will produce a error diff. PR-URL: https://github.com/nodejs/node/pull/17615 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-01-21doc: Add example of null to assert.ifErrorLeko
PR-URL: https://github.com/nodejs/node/pull/18236 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
2018-01-18doc: add missing link referencesVse Mozhet Byt
PR-URL: https://github.com/nodejs/node/pull/18222 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-01-16assert: throw without args in okRuben Bridgewater
`assert.ok()` should always receive a value. Otherwise there might be a bug or it was intended to use `assert.fail()`. PR-URL: https://github.com/nodejs/node/pull/17581 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ron Korving <ron@ronkorving.nl>
2018-01-16assert: improve simple assertRuben Bridgewater
This improves the error message in simple asserts by using the real call information instead of the already evaluated part. PR-URL: https://github.com/nodejs/node/pull/17581 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ron Korving <ron@ronkorving.nl>
2018-01-12doc: capitalize non-primitive typesVse Mozhet Byt
PR-URL: https://github.com/nodejs/node/pull/18111 Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-12-21assert: .throws accept objectsRuben Bridgewater
From now on it is possible to use a validation object in throws instead of the other possibilites. PR-URL: https://github.com/nodejs/node/pull/17584 Refs: https://github.com/nodejs/node/pull/17557 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ron Korving <ron@ronkorving.nl> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
2017-12-19doc: improve .throws RegExp infoRuben Bridgewater
It was not clear why the error name is actually also tested for when using a regular expression. This is now clarified. PR-URL: https://github.com/nodejs/node/pull/17585 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
2017-12-19assert: improve assert.throwsRuben Bridgewater
Throw a TypeError in case a error message is provided in the second argument and a third argument is present as well. This is clearly a mistake and should not be done. PR-URL: https://github.com/nodejs/node/pull/17585 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
2017-12-05doc: use colon consistently in assert.mdRich Trott
PR-URL: https://github.com/nodejs/node/pull/17463 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>