win32.dirname = function(path) {
- assertPath(path);
-
var result = win32SplitPath(path),
root = result[0],
dir = result[1];
win32.basename = function(path, ext) {
- assertPath(path);
-
if (ext !== undefined && typeof ext !== 'string')
throw new TypeError('ext must be a string');
win32.extname = function(path) {
- assertPath(path);
return win32SplitPath(path)[3];
};
posix.dirname = function(path) {
- assertPath(path);
-
var result = posixSplitPath(path),
root = result[0],
dir = result[1];
posix.basename = function(path, ext) {
- assertPath(path);
-
if (ext !== undefined && typeof ext !== 'string')
throw new TypeError('ext must be a string');
posix.extname = function(path) {
- assertPath(path);
return posixSplitPath(path)[3];
};
fail(path.resolve, test);
fail(path.normalize, test);
fail(path.isAbsolute, test);
- fail(path.dirname, test);
fail(path.relative, test, 'foo');
fail(path.relative, 'foo', test);
- fail(path.basename, test);
- fail(path.extname, test);
fail(path.parse, test);
+ // These methods should throw a TypeError, but do not for backwards
+ // compatibility. Uncommenting these lines in the future should be a goal.
+ // fail(path.dirname, test);
+ // fail(path.basename, test);
+ // fail(path.extname, test);
+
// undefined is a valid value as the second argument to basename
if (test !== undefined) {
fail(path.basename, 'foo', test);