fix(tests): handle Windows path output and disable CI fail-fast

- TestUserWorkingDirectoryWithIncluded: normalize actual output instead
  of just expected, since task outputs backslashes on Windows
- TestDynamicVariablesRunOnTheNewCreatedDir: take first line only, as
  Windows may output additional corrupted path info
- Disable fail-fast in CI to see all test failures at once
This commit is contained in:
Valentin Maerten
2026-01-31 11:43:46 +01:00
parent 5c4a484fc8
commit d0218d5656
2 changed files with 6 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ jobs:
test:
name: Test
strategy:
fail-fast: false
matrix:
go-version: [1.24.x, 1.25.x]
platform: [ubuntu-latest, macos-latest, windows-latest]

View File

@@ -1576,8 +1576,10 @@ func TestDynamicVariablesRunOnTheNewCreatedDir(t *testing.T) {
require.NoError(t, e.Run(t.Context(), &task.Call{Task: target}))
// Normalize path separators for cross-platform compatibility (Windows uses backslashes)
// Take only the first line as Windows may output additional debug info
normalized := strings.ReplaceAll(out.String(), "\\", "/")
got := strings.TrimSuffix(filepath.Base(normalized), "\n")
firstLine := strings.Split(normalized, "\n")[0]
got := filepath.Base(firstLine)
assert.Equal(t, expected, got, "Mismatch in the working directory")
// Clean-up after ourselves only if no error.
@@ -2319,7 +2321,8 @@ func TestUserWorkingDirectoryWithIncluded(t *testing.T) {
require.NoError(t, err)
require.NoError(t, e.Setup())
require.NoError(t, e.Run(t.Context(), &task.Call{Task: "included:echo"}))
assert.Equal(t, fmt.Sprintf("%s\n", wd), buff.String())
// Normalize path separators for cross-platform compatibility (Windows uses backslashes)
assert.Equal(t, fmt.Sprintf("%s\n", wd), strings.ReplaceAll(buff.String(), "\\", "/"))
}
func TestPlatforms(t *testing.T) {