diff --git a/src/path.ts b/src/path.ts index a61bee0..f295bd5 100644 --- a/src/path.ts +++ b/src/path.ts @@ -70,7 +70,7 @@ export const join: typeof path.join = function (...args) { return '.' } - return normalize(joined) + return normalize(joined.replace(/\/\/+/g, '/')) } // resolve diff --git a/test/index.spec.ts b/test/index.spec.ts index d1e6048..e3e43e5 100644 --- a/test/index.spec.ts +++ b/test/index.spec.ts @@ -80,6 +80,8 @@ runTest('format', format, [ ]) runTest('join', join, [ + ['/', '/path', '/path'], + ['/test//', '//path', '/test/path'], ['some/nodejs/deep', '../path', 'some/nodejs/path'], ['./some/local/unix/', '../path', 'some/local/path'], ['./some\\current\\mixed', '..\\path', 'some/current/path'], @@ -168,6 +170,7 @@ runTest('relative', relative, [ runTest('resolve', resolve, [ // POSIX + ['/', '/path', '/path'], ['/foo/bar', './baz', '/foo/bar/baz'], ['/foo/bar', '/tmp/file/', '/tmp/file'], ['wwwroot', 'static_files/png/', '../gif/image.gif', `${process.cwd()}/wwwroot/static_files/gif/image.gif`],