aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-whatwg-url.js
AgeCommit message (Collapse)Author
2019-11-19util: escape C1 control characters and switch to hex formatRuben Bridgewater
C1 control characters will from now on also be escaped to prevent altering the terminal behavior. Fixes: https://github.com/nodejs/node/issues/29450 PR-URL: https://github.com/nodejs/node/pull/29826 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-01-11url: return backslashes from fileURLToPath on winKevin Smith
PR-URL: https://github.com/nodejs/node/pull/25349 Fixes: https://github.com/nodejs/node/issues/25265 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
2018-12-17doc,lib,test: capitalize comment sentencesRuben Bridgewater
This activates the eslint capitalize comment rule for comments above 50 characters. PR-URL: https://github.com/nodejs/node/pull/24996 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-03-07lib: port remaining errors to new systemMichaël Zasso
PR-URL: https://github.com/nodejs/node/pull/19137 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2018-02-08fs: throw errors on invalid paths synchronouslyJoyee Cheung
- Throw getPathFromURL() and nullCheck() errors synchronously instead of deferring them to the next tick, since we already throw validatePath() errors synchronously. - Merge nullCheck() into validatePath() - Never throws in `fs.exists()`, instead, invoke the callback with false, or emit a warning when the callback is not a function. This is to bring it inline with fs.existsSync(), which never throws. - Updates the comment of rethrow() - Throw ERR_INVALID_ARG_VALUE for null checks PR-URL: https://github.com/nodejs/node/pull/18308 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-10test: replace common.fixturesDir with fixturesChris Jimenez
PR-URL: https://github.com/nodejs/node/pull/15806 Reviewed-By: Ryan Graham <r.m.graham@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2017-08-31errors: convert 'fs'matzavinos
covert lib/fs.js over to using lib/internal/errors.js i have not addressed the cases that use errnoException(), for reasons described in GH-12926 - throw the ERR_INVALID_CALLBACK error when the the callback is invalid - replace the ['object', 'string'] with ['string', 'object'] in the error constructor call, to better match the previous err msg in the getOptions() function - add error ERR_VALUE_OUT_OF_RANGE in lib/internal/errors.js, this error is thrown when a numeric value is out of range - document the ERR_VALUE_OUT_OF_RANGE err in errors.md - correct the expected args, in the error thrown in the function fs._toUnixTimestamp() to ['Date', 'time in seconds'] (lib/fs.js) - update the listener error type in the fs.watchFile() function, from Error to TypeError (lib/fs.js) - update errors from ERR_INVALID_OPT_VALUE to ERR_INVALID_ARG_TYPE in the functions fs.ReadStream() and fs.WriteStream(), for the cases of range errors use the new error: ERR_VALUE_OUT_OF_RANGE (lib/fs.js) PR-URL: https://github.com/nodejs/node/pull/15043 Refs: https://github.com/nodejs/node/issues/11273 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.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-06-24test: remove require('buffer') on 6 fs test filessallen450
* test/parallel/test-fs-mkdtemp.js * test/parallel/test-fs-read-zero-length.js * test/parallel/test-fs-read.js * test/parallel/test-fs-whatwg-url.js * test/parallel/test-fs-write-string-coerce.js * test/parallel/test-fs-write.js PR-URL: https://github.com/nodejs/node/pull/13845 Refs: https://github.com/nodejs/node/issues/13836 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2017-04-25url: port WHATWG URL API to internal/errorsTimothy Gu
Also slightly revises grammar. PR-URL: https://github.com/nodejs/node/pull/12574 Refs: https://github.com/nodejs/node/issues/11273 Refs: https://github.com/nodejs/node/issues/11299 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
2017-02-06fs: allow WHATWG URL and file: URLs as pathsJames M Snell
Updates the fs module APIs to allow 'file://' URL objects to be passed as the path. For example: ```js const URL = require('url').URL; const myURL = new URL('file:///C:/path/to/file'); fs.readFile(myURL, (err, data) => {}); ``` On Windows, file: URLs with a hostname convert to UNC paths, while file: URLs with drive letters convert to local absolute paths: ``` file://hostname/a/b/c => \\hostname\a\b\c file:///c:/a/b/c => c:\a\b\c ``` On all other platforms, file: URLs with a hostname are unsupported and will result in a throw: ``` file://hostname/a/b/c => throw! file:///a/b/c => /a/b/c ``` The documentation for the fs API is intentionally not updated in this commit because the URL API is still considered experimental and is not officially documented *at this time* Note that file: URLs are *required* by spec to always be absolute paths from the file system root. This is a semver-major commit because it changes error handling on the fs APIs. PR-URL: https://github.com/nodejs/node/pull/10739 Ref: https://github.com/nodejs/node/issues/10703 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-02-03Revert "fs: allow WHATWG URL and file: URLs as paths"James M Snell
This reverts commit 79400bfbfdea32e861a30cadeb2f7363e99bcaca. PR-URL: https://github.com/nodejs/node/pull/11155 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
2017-02-03fs: allow WHATWG URL and file: URLs as pathsJames M Snell
Updates the fs module APIs to allow 'file://' URL objects to be passed as the path. For example: ```js const URL = require('url').URL; const myURL = new URL('file:///C:/path/to/file'); fs.readFile(myURL, (err, data) => {}); ``` On Windows, file: URLs with a hostname convert to UNC paths, while file: URLs with drive letters convert to local absolute paths: ``` file://hostname/a/b/c => \\hostname\a\b\c file:///c:/a/b/c => c:\a\b\c ``` On all other platforms, file: URLs with a hostname are unsupported and will result in a throw: ``` file://hostname/a/b/c => throw! file:///a/b/c => /a/b/c ``` The documentation for the fs API is intentionally not updated in this commit because the URL API is still considered experimental and is not officially documented *at this time* Note that file: URLs are *required* by spec to always be absolute paths from the file system root. This is a semver-major commit because it changes error handling on the fs APIs. PR-URL: https://github.com/nodejs/node/pull/10739 Ref: https://github.com/nodejs/node/issues/10703 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>