From 466faeb14f1f83bbb60090cb6643a67e779c3e2f Mon Sep 17 00:00:00 2001 From: DuanPengfei <2459714173@qq.com> Date: Sat, 17 Jun 2017 16:55:12 +0800 Subject: [PATCH] path: fix posix.relative returns different results Throw an error `ERR_UNSUPPORTED_PLATFOMR` when direct use `path.posix.resolve` on Windows or direct use `path.win32.resolve` on *nix. Update docs, list win32 functions do not support direct use on *nix and posix functions do not support direct use on Windows. Update tests, only run current platform type test. Fixes: https://github.com/nodejs/node/issues/13683 Refs: https://github.com/nodejs/node/pull/13714 --- doc/api/path.md | 8 ++ lib/internal/errors.js | 1 + lib/path.js | 14 +++ test/parallel/test-path.js | 230 ++++++++++++++++++++++--------------- 4 files changed, 163 insertions(+), 90 deletions(-) diff --git a/doc/api/path.md b/doc/api/path.md index a5c5af6d068704..e8e548170f81a5 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -431,6 +431,10 @@ added: v0.11.15 The `path.posix` property provides access to POSIX specific implementations of the `path` methods. +The following functions do not support direct use on Windows. +* path.posix.resolve +* path.posix.relative + ## path.relative(from, to)