Skip to content

Commit

Permalink
??!
Browse files Browse the repository at this point in the history
  • Loading branch information
mstoykov committed Feb 5, 2025
1 parent dee0609 commit d3333e2
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions internal/js/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand All @@ -731,14 +727,14 @@ 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
}
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} {
Expand All @@ -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)
}
}
Expand Down

0 comments on commit d3333e2

Please sign in to comment.