From d3333e2b1b5537512be12827149fa377dc41fe52 Mon Sep 17 00:00:00 2001 From: Mihail Stoykov Date: Wed, 5 Feb 2025 14:04:53 +0200 Subject: [PATCH] ??! --- internal/js/bundle_test.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/internal/js/bundle_test.go b/internal/js/bundle_test.go index 04c50e9ea61..c2fbfb2347b 100644 --- a/internal/js/bundle_test.go +++ b/internal/js/bundle_test.go @@ -718,10 +718,6 @@ func TestOpen(t *testing.T) { defer cleanUp() fs = fsext.NewReadOnlyFs(fs) openPath := tCase.openPath - // if fullpath prepend prefix - if isWindows { - openPath = strings.ReplaceAll(openPath, `\`, `\\`) - } pwd := tCase.pwd if pwd == "" { pwd = "/path/to/" @@ -731,6 +727,7 @@ func TestOpen(t *testing.T) { export default function() { return file };` sourceBundle, err := getSimpleBundle(t, filepath.ToSlash(filepath.Join(pwd, "script.js")), data, fs) + if tCase.isError { require.Error(t, err) return @@ -738,7 +735,6 @@ func TestOpen(t *testing.T) { require.NoError(t, err) arcBundle, err := NewBundleFromArchive(getTestPreInitState(t, logger, nil), sourceBundle.makeArchive()) - require.NoError(t, err) for source, b := range map[string]*Bundle{"source": sourceBundle, "archive": arcBundle} { @@ -754,10 +750,10 @@ func TestOpen(t *testing.T) { } t.Run(tCase.name, testFunc) - if isWindows { + if isWindows && !strings.HasPrefix(tCase.openPath, "file://") { // windowsify the testcase - tCase.openPath = strings.ReplaceAll(tCase.openPath, `/`, `\`) - tCase.pwd = strings.ReplaceAll(tCase.pwd, `/`, `\`) + tCase.openPath = strings.ReplaceAll(tCase.openPath, `/`, `\\`) + tCase.pwd = strings.ReplaceAll(tCase.pwd, `/`, `\\`) t.Run(tCase.name+" with windows slash", testFunc) } }