1
0
mirror of https://github.com/go-task/task.git synced 2025-11-23 22:24:45 +02:00

fix: Print dotenv file path when there is an error reading file (#1842)

This commit is contained in:
Paulo Bittencourt
2024-09-29 16:03:48 -04:00
committed by GitHub
parent e619bad4a9
commit 8d0f0b049c
4 changed files with 24 additions and 1 deletions

View File

@@ -1657,6 +1657,18 @@ func TestDotenvHasEnvVarInPath(t *testing.T) {
tt.Run(t)
}
func TestTaskDotenvParseErrorMessage(t *testing.T) {
e := task.Executor{
Dir: "testdata/dotenv/parse_error",
}
path, _ := filepath.Abs(filepath.Join(e.Dir, ".env-with-error"))
expected := fmt.Sprintf("error reading env file %s:", path)
err := e.Setup()
require.ErrorContains(t, err, expected)
}
func TestTaskDotenv(t *testing.T) {
tt := fileContentTest{
Dir: "testdata/dotenv_task/default",