summaryrefslogtreecommitdiff
path: root/test/parallel/test-util.js
AgeCommit message (Collapse)Author
2019-07-29test, util: refactor isObject in test-utilAlex Ramirez
refactor the test for isObject function including falsy values, the use of strictEquals and the format actual, expected PR-URL: https://github.com/nodejs/node/pull/28878 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Yuta Hiroto <hello@hiroppy.me> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-01-10lib: move DEP0029 to end of lifecjihrig
PR-URL: https://github.com/nodejs/node/pull/25377 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> 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: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-01-10lib: move DEP0028 to end of lifecjihrig
PR-URL: https://github.com/nodejs/node/pull/25377 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> 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: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-01-10lib: move DEP0027 to end of lifecjihrig
PR-URL: https://github.com/nodejs/node/pull/25377 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> 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: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-01-10lib: move DEP0026 to end of lifecjihrig
PR-URL: https://github.com/nodejs/node/pull/25377 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> 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: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-10-15test: corrected assertion arguments orderfrancois
Fixed the order of expected arguments for assert.strictEqual() PR-URL: https://github.com/nodejs/node/pull/23569 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2018-09-27test: test undefined in utilZYSzys
PR-URL: https://github.com/nodejs/node/pull/22741 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-06-04test: make handling of noWarnCode stricterTobias Nießen
This change requires all expected warnings to be specified along with their respective code and will raise an error if the code does not match. This also kind of fixes the behavior when the expected warning code was noWarnCode and there is an actual warning code. PR-URL: https://github.com/nodejs/node/pull/21075 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-03-26test: add deprecation code to expectWarningDaniel Bevenius
This commit adds a deprecation code to expectWarning and updates the function to check the passed code against the code property on the warning object. Not all warnings have a deprecation code so for those that don't an explicit code of common.noWarnCode is required. Passing this skips the assertion of the code. PR-URL: https://github.com/nodejs/node/pull/19474 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2018-03-11test: add regression testsRuben Bridgewater
This makes sure util.isDate and util.isRegExp will not abort in case more than one argument is passed to the utility function. PR-URL: https://github.com/nodejs/node/pull/19188 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-03-10lib: remove unused internal error constructorsMichaël Zasso
PR-URL: https://github.com/nodejs/node/pull/19203 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2018-03-05util: introduce `util.types.is[…]` type checksAnna Henningsen
Provide public APIs for native typechecking that is actually useful. The motivation for this is providing alternatives to userland modules that would currently rely on `process.binding('util')`. PR-URL: https://github.com/nodejs/node/pull/18415 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
2017-07-21lib,src: fix consistent spacing inside bracesSebastiaan Deckers
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>
2017-06-30test: verify isNativeError accepts internal errorscjihrig
This commit verifies that Node's internal errors are recognized by V8's IsNativeError(), which is exposed in Node as process.binding('util').isNativeError(). PR-URL: https://github.com/nodejs/node/pull/13965 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-04-28test: remove eslint comments from test-util.jscjihrig
PR-URL: https://github.com/nodejs/node/pull/12669 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-04-25src: expose V8's IsNativeError() in util bindingscjihrig
Refs: https://github.com/nodejs/node/pull/12400 PR-URL: https://github.com/nodejs/node/pull/12546 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-03-10meta: restore original copyright headerJames M Snell
A prior io.js era commit inappropriately removed the original copyright statements from the source. This restores those in any files still remaining from that edit. Ref: https://github.com/nodejs/TSC/issues/174 Ref: https://github.com/nodejs/node/pull/10599 PR-URL: https://github.com/nodejs/node/pull/10155 Note: This PR was required, reviewed-by and approved by the Node.js Foundation Legal Committee and the TSC. There is no `Approved-By:` meta data.
2017-01-11test: s/assert.equal/assert.strictEqual/Gibson Fahnestock
Use assert.strictEqual instead of assert.equal in tests, manually convert types where necessary. PR-URL: https://github.com/nodejs/node/pull/10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
2016-09-24test: add expectWarning to commonMichaël Zasso
There are multiple tests that use the same boilerplate to test that warnings are correctly emitted. This adds a new common function to do that and changes the tests to use it. PR-URL: https://github.com/nodejs/node/pull/8662 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-09-20test: improve coverage of the util moduleMichaël Zasso
Add tests for untested branches and statements. Change assert.equal to assert.strictEqual for consistency. PR-URL: https://github.com/nodejs/node/pull/8633 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
2016-09-12tools: fix new-parens violationsRich Trott
PR-URL: https://github.com/nodejs/node/pull/8478 Reviewed-By: James M Snell <jasnell@gmail.com>
2016-05-08tools: lint for object literal spacingRich Trott
There has been occasional nits for spacing in object literals in PRs but the project does not lint for it and it is not always handled consistently in the existing code, even on adjacent lines of a file. This change enables a linting rule requiring no space between the key and the colon, and requiring at least one space (but allowing for more so property values can be lined up if desired) between the colon and the value. This appears to be the most common style used in the current code base. Example code the complies with lint rule: myObj = { foo: 'bar' }; Examples that do not comply with the lint rule: myObj = { foo : 'bar' }; myObj = { foo:'bar' }; PR-URL: https://github.com/nodejs/node/pull/6592 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
2016-04-22test,benchmark: use deepStrictEqual()Rich Trott
In preparation for a lint rule that will enforce assert.deepStrictEqual() over assert.deepEqual(), change tests and benchmarks accordingly. For tests and benchmarks that are testing or benchmarking assert.deepEqual() itself, apply a comment to ignore the upcoming rule. PR-URL: https://github.com/nodejs/node/pull/6213 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-03-16buffer: add .from(), .alloc() and .allocUnsafe()James M Snell
Several changes: * Soft-Deprecate Buffer() constructors * Add `Buffer.from()`, `Buffer.alloc()`, and `Buffer.allocUnsafe()` * Add `--zero-fill-buffers` command line option * Add byteOffset and length to `new Buffer(arrayBuffer)` constructor * buffer.fill('') previously had no effect, now zero-fills * Update the docs PR-URL: https://github.com/nodejs/node/pull/4682 Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2015-12-26test: remove unnecessary assignmentsRich Trott
common.js needs to be loaded in all tests so that there is checking for variable leaks and possibly other things. However, it does not need to be assigned to a variable if nothing in common.js is referred to elsewhere in the test. PR-URL: https://github.com/nodejs/node/pull/4408 Reviewed-By: James M Snell <jasnell@gmail.com>
2015-10-26test: improve tests for util.inheritsMichaël Zasso
inherits is used in lib and tests but its functionality itself is not tested yet. PR-URL: https://github.com/nodejs/node/pull/3507 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2015-06-16buffer: fix cyclic dependency with utilBrendan Ashworth
PR-URL: https://github.com/nodejs/io.js/pull/1988 Fixes: https://github.com/nodejs/io.js/issues/1987 Reviewed-By: Roman Reiss <me@silverwind.io>
2015-05-19test: enable linting for testsRoman Reiss
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>
2015-03-22util: Check input to util.inheritsConnor Peet
PR-URL: https://github.com/iojs/io.js/pull/1240 Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com> Reviewed-By: Petka Antonov <petka_antonov@hotmail.com>
2015-02-07util: simplify `isPrimitive`Vladimir Kurchatkin
Everything that is not an object should be a primitive. PR-URL: https://github.com/iojs/io.js/pull/739 Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-12Remove excessive copyright/license boilerplateisaacs
The copyright and license notice is already in the LICENSE file. There is no justifiable reason to also require that it be included in every file, since the individual files are not individually distributed except as part of the entire package.
2014-12-17test: split test in parallel/sequentialFedor Indutny
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> PR-URL: https://github.com/iojs/io.js/pull/172 Fix: iojs/io.js#139