mirror of
https://github.com/go-task/task.git
synced 2026-02-24 20:20:30 +01:00
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:
1
.github/workflows/test.yml
vendored
1
.github/workflows/test.yml
vendored
@@ -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]
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user