Skip to content

Commit af620d8

Browse files
committed
Fix missing env file test
1 parent dbce3be commit af620d8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cli/run_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"os"
88
"os/exec"
99
"path/filepath"
10+
"regexp"
1011
"runtime"
1112
"strings"
1213
"testing"
@@ -26,7 +27,12 @@ func TestRunCommand(t *testing.T) {
2627
t.Fatal(err.Error())
2728
}
2829

29-
assert.Regexp(t, "Error: failed to load env file from .+/dispatch/cli/non-existent.env: open non-existent.env: no such file or directory\n", buff.String())
30+
errMsg := "no such file or directory\n"
31+
path := regexp.QuoteMeta(filepath.FromSlash("/dispatch/cli/non-existent.env"))
32+
if runtime.GOOS == "windows" {
33+
errMsg = "The system cannot find the file specified.\n"
34+
}
35+
assert.Regexp(t, "Error: failed to load env file from .+"+path+": open non-existent\\.env: "+errMsg, buff.String())
3036
})
3137

3238
t.Run("Run with env file", func(t *testing.T) {

0 commit comments

Comments
 (0)