From 45708f897f14bced8867713c8c2db584f4f1b9ee Mon Sep 17 00:00:00 2001 From: legendecas Date: Tue, 22 Aug 2023 01:49:44 +0800 Subject: [PATCH 1/2] test: verify dynamic import call with absolute path strings --- test/es-module/test-esm-dynamic-import.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/es-module/test-esm-dynamic-import.js b/test/es-module/test-esm-dynamic-import.js index d246841c2a6d8b..ca6a0e238cbb9d 100644 --- a/test/es-module/test-esm-dynamic-import.js +++ b/test/es-module/test-esm-dynamic-import.js @@ -65,5 +65,9 @@ function expectFsNamespace(result) { expectModuleError(import('C:\\example\\foo.mjs'), 'ERR_UNSUPPORTED_ESM_URL_SCHEME', msg); + } else { + // If the specifier is an absolute path string without a scheme, it should + // be treated as a file URL. + expectOkNamespace(import(absolutePath)); } })(); From c81e1e6f7afed48c534f4b7cd997661e7620e846 Mon Sep 17 00:00:00 2001 From: Chengzhong Wu Date: Wed, 30 Aug 2023 10:42:43 +0800 Subject: [PATCH 2/2] fixup! test: verify dynamic import call with absolute path strings Co-authored-by: Antoine du Hamel --- test/es-module/test-esm-dynamic-import.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/es-module/test-esm-dynamic-import.js b/test/es-module/test-esm-dynamic-import.js index ca6a0e238cbb9d..f69682ef3bca8f 100644 --- a/test/es-module/test-esm-dynamic-import.js +++ b/test/es-module/test-esm-dynamic-import.js @@ -65,9 +65,8 @@ function expectFsNamespace(result) { expectModuleError(import('C:\\example\\foo.mjs'), 'ERR_UNSUPPORTED_ESM_URL_SCHEME', msg); - } else { - // If the specifier is an absolute path string without a scheme, it should - // be treated as a file URL. - expectOkNamespace(import(absolutePath)); } + // If the specifier is an origin-relative URL, it should + // be treated as a file: URL. + expectOkNamespace(import(targetURL.pathname)); })();