summaryrefslogtreecommitdiff
path: root/test/parallel/test-path-parse-format.js
AgeCommit message (Collapse)Author
2019-03-28path: fix win32 parse regressionRuben Bridgewater
This fixes the parse function for single character input that are not a path separator. PR-URL: https://github.com/nodejs/node/pull/26912 Fixes: https://github.com/nodejs/node/issues/26911 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-28test: refactor path parse testRuben Bridgewater
Use destructuring and arrow functions and make one test stricter. Also inline the error object as there's only a sinlge error that can currently be thrown in the path module. PR-URL: https://github.com/nodejs/node/pull/26912 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michaël Zasso <targos@protonmail.com>
2018-03-25lib: always show ERR_INVALID_ARG_TYPE received partRuben Bridgewater
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>
2017-12-08test: replace assert.throws w/ common.expectsErrorMithun Sasidharan
PR-URL: https://github.com/nodejs/node/pull/17498 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
2017-07-30path: fix win32 volume-relative pathsTimothy Gu
`path.resolve()` and `path.join()` are left alone in this commit due to the lack of clear semantics. PR-URL: https://github.com/nodejs/node/pull/14440 Fixes: https://github.com/nodejs/node/issues/14405 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-07-26test: increase coverage for path.parseTobias Nießen
PR-URL: https://github.com/nodejs/node/pull/14438 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe>
2017-07-23test: replace concatenation with template literalsxeodou
PR-URL: https://github.com/nodejs/node/pull/14281 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@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-07-09test: common.expectsError should be a must callRuben Bridgewater
Wrap expectsError in mustCall to make sure it's really called as expected. PR-URL: https://github.com/nodejs/node/pull/14088 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2017-07-03path: fix incorrect use of ERR_INVALID_ARG_TYPETobias Nießen
PR-URL: https://github.com/nodejs/node/pull/14011 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-07-02test: replace indexOf with includes and startsWithNataly Shrits
PR-URL: https://github.com/nodejs/node/pull/13852 Refs: https://github.com/nodejs/node/issues/12586 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2017-06-06path: use internal/errors.jsSebastian Van Sande
PR-URL: https://github.com/nodejs/node/pull/11319 Ref: https://github.com/nodejs/node/issues/11273 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-05-05test: reduce string concatenationsVse Mozhet Byt
PR-URL: https://github.com/nodejs/node/pull/12735 Refs: https://github.com/nodejs/node/pull/12455 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-03-29tools: add unescaped regexp dot rule to linterBrian White
PR-URL: https://github.com/nodejs/node/pull/11834 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@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-02-09test: improve checks in test-path-parse-formatcjihrig
- validate full error messages - use assert.throws() instead of try...catch PR-URL: https://github.com/nodejs/node/pull/11223 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
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>
2017-01-11test: use eslint to fix var->const/letGibson Fahnestock
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>
2016-07-15test: s/assert.fail/common.fail as appropriatecjihrig
Many tests use assert.fail(null, null, msg) where it would be simpler to use common.fail(msg). This is largely because common.fail() is fairly new. This commit makes the replacement when applicable. PR-URL: https://github.com/nodejs/node/pull/7735 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-04-18lib,test,tools: alignment on variable assignmentsRich Trott
Correct alignment on variable assignments that span multiple lines in preparation for lint rule to enforce such alignment. PR-URL: https://github.com/nodejs/node/pull/6242 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-02-29path: fix win32 parse()Zheng Chaoping
Fix path.win32.parse("/foo/bar") retuns `{root: '' ...}`(v5.7.0), but not `{root: '/' ...}`(v5.6.0). PR-URL: https://github.com/nodejs/node/pull/5484 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Roman Reiss <me@silverwind.io>
2016-02-09test: improve path testsBrian White
This commit adds new tests, executes tests for other platforms instead of limiting platform-specific tests to those platforms, and fixes a few style/formatting inconsistencies. PR-URL: https://github.com/nodejs/node/pull/5123 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-13test: fix style issues after eslint updateMichaël Zasso
Replace var keyword with const or let. PR-URL: https://github.com/nodejs/io.js/pull/2286 Reviewed-By: Roman Reiss <me@silverwind.io>
2015-11-27path: make format() consistent and more functionalNathan Woltman
Make the win32 and posix versions of path.format() consistent in when they add a directory separator between the dir and base parts of the path (always add it unless the dir part is the same as the root). Also, path.format() is now more functional in that it uses the name and ext parts of the path if the base part is left out and it uses the root part if the dir part is left out. Reviewed-By: João Reis <reis@janeasystems.com> Reviewed-By: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/2408
2015-11-10test: fix tests that check error messagescjihrig
20285ad17755187ece16b8a5effeaa87f5407da2 changed the format of error messages throughout lib. However, the tests were not updated to reflect these changes. This commit makes those changes. PR-URL: https://github.com/nodejs/node/pull/3727 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: James M Snell <jasnell@gmail.com>
2015-10-16test: apply correct assert.fail() argumentsRich Trott
The assert.fail function signature has the message as the third argument but, understandably, it is often assumed that it is the first argument (or at least the first argument if no other arguments are passed). This corrects the assert.fail() invocations in the Node.js tests. Before: assert.fail('message'); // result: AssertionError: 'message' undefined undefined After: assert.fail(null, null, 'message'); // result: AssertionError: message PR-URL: https://github.com/nodejs/node/pull/3378 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-10-01test: load common.js to test for global leaksRich Trott
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>
2015-08-09path: remove dead code in favor of unit testsNathan Woltman
Remove dead code paths that are created by assertions that will never trigger. They may only trigger if either the `splitDeviceRe` or `splitPathRe` regular expressions are modified. If at some point they are modified, current unit tests will catch most of the resulting errors and this commit adds extra tests to catch the remaining errors. PR-URL: https://github.com/nodejs/io.js/pull/2282 Reviewed-By: Roman Reiss <me@silverwind.io>
2015-07-04path: refactor for performance and consistencyNathan Woltman
Improve performance by: + Not leaking the `arguments` object! + Getting the last character of a string by index, instead of with `.substr()` or `.slice()` Improve code consistency by: + Using `[]` instead of `.charAt()` where possible + Using a function declaration instead of a var declaration + Using `.slice()` with clearer arguments + Checking if `dir` is truthy in `win32.format` (added tests for this) Improve both by: + Making the reusable `trimArray()` function + Standardizing getting certain path statistics with the new `win32StatPath()` function PR-URL: https://github.com/nodejs/io.js/pull/1778 Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> 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-16path: add type checking for path inputscjihrig
This commit adds type checking of path inputs to exported methods in the path module. The exception is _makeLong(), which seems to explicitly support any data type. Fixes: https://github.com/iojs/io.js/issues/1139 PR-URL: https://github.com/iojs/io.js/pull/1153 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
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