- Rename normalizeLineEndings to normalizeOutput (clearer name)
- Add normalizePathSeparators helper for string path normalization
- Replace inline strings.ReplaceAll patterns with helper function
- Add unit tests for both normalization functions
- 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
On Windows, paths returned by pwd or filepath operations use
backslashes which get interpreted as escape sequences when
printed. This caused tests to fail with corrupted path output.
Fix by normalizing path separators before comparison:
- TestWhenNoDirAttributeItRunsInSameDirAsTaskfile
- TestWhenDirAttributeAndDirExistsItRunsInThatDir
- TestWhenDirAttributeItCreatesMissingAndRunsInThatDir
- TestDynamicVariablesRunOnTheNewCreatedDir
- TestUserWorkingDirectory
- TestUserWorkingDirectoryWithIncluded
Instead of manually handling template substitution, normalize the output
before passing it to AssertWithTemplate. This keeps goldie's features
(diff, -update flag) intact while ensuring cross-platform compatibility.
goldie's AssertWithTemplate doesn't respect the EqualFn option, so we
manually handle template substitution and use NormalizedEqual directly
for cross-platform comparison.
- Extend normalizeLineEndings to convert backslashes to forward slashes
- Normalize TEST_DIR with filepath.ToSlash() for template data
- Fix TestIncludedTaskfileVarMerging assertion to use filepath.ToSlash()
This fixes golden file tests on Windows where paths contain backslashes.
Use filepath.ToSlash() in test assertions to handle Windows backslashes:
- TestIncludesOptionalImplicitFalse
- TestIncludesOptionalExplicitFalse
- TestIncludesRelativePath
- Normalize paths to forward slashes in glob.go for consistent sorting
- Use filepath.ToSlash in error messages to avoid double-escaped backslashes
- Add goldie.WithEqualFn for cross-platform line ending normalization
- Simplify CI workflow (go run ./cmd/task test)
Previously if a task was run as a dependency of another task,
the error message simply reported something like:
exit status 1
It is desirable instead to name the root task and all child tasks in the tree
to the failing task.
After this PR, the error message will read:
task: Failed to run task "root": task: Failed to run task "failing-task": exit status 1
* feat: redact credentials in remote urls
* chore: improve function naming
* fix: TaskfileNotSecureError should use redacted URI
* feat: unexport all node implementation fields
* fix: unexport HTTPNode.url
* feat: use TaskTest for executor tests
* feat: more tests
* feat: separate tests for executing and formatting with new functional options that work for both test types
* feat: formatter tests
* refactor: more tests
* refactor: executor functional options
* refactor: minor tidy up of list code
* fix: WithVersionCheck missing from call to NewExecutor
* feat: docstrings for structs with functional options
* refactor: prefix the functional options with the name of the struct they belong to
* change what is printed when creating Taskfile
When using --init to create a new Taskfile, it used to print the whole contents of the file to the terminal, which was unnecessarily verbose (and honestly felt unintentional).
Now only the filename is printed by default and the --silent and --verbose flags can be used to control the behavior (print nothing or content + filename, respectively).
* include additional new line with -i -v
it looks slightly better in the terminal.
* print init success text in green
* fix TestInit, create and pass in a logger
* move logging outside of InitTaskfile
- revert API changes made to InitTaskfile
- make consts in init.go public so they can be accessed from task.go
- rename variable "logger" to "log" in task.go to fix conflict with logger package
* move TestInit into init_test.go file
as requested by pd93.
* forward env to RunCommand when evaluating sh vars. fixes#1742
* feat: added tests
* fix: test
---------
Co-authored-by: Pete Davison <pd93.uk@outlook.com>