mirror of
https://github.com/go-task/task.git
synced 2025-06-15 00:15:10 +02:00
Remove ignore_errors
This commit is contained in:
26
task_test.go
26
task_test.go
@ -301,38 +301,18 @@ func TestPrecondition(t *testing.T) {
|
||||
|
||||
// Calling a task with a precondition in a dependency fails the task
|
||||
assert.Error(t, e.Run(context.Background(), taskfile.Call{Task: "depends_on_imposssible"}))
|
||||
if buff.String() != "1 != 0\n" {
|
||||
|
||||
if buff.String() != "1 != 0\ntask: precondition not met\n" {
|
||||
t.Errorf("Wrong output message: %s", buff.String())
|
||||
}
|
||||
buff.Reset()
|
||||
|
||||
// Calling a task with a precondition in a cmd fails the task
|
||||
assert.Error(t, e.Run(context.Background(), taskfile.Call{Task: "executes_failing_task_as_cmd"}))
|
||||
if buff.String() != "1 != 0\n" {
|
||||
if buff.String() != "1 != 0\ntask: precondition not met\n" {
|
||||
t.Errorf("Wrong output message: %s", buff.String())
|
||||
}
|
||||
buff.Reset()
|
||||
|
||||
// A task with a failing precondition and ignore_errors on still fails
|
||||
assert.Error(t, e.Run(context.Background(), taskfile.Call{Task: "impossible_but_i_dont_care"}))
|
||||
if buff.String() != "2 != 1\n" {
|
||||
t.Errorf("Wrong output message: %s", buff.String())
|
||||
}
|
||||
buff.Reset()
|
||||
|
||||
// If a precondition has ignore errors, then it will allow _dependent_ tasks to execute
|
||||
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "depends_on_failure_of_impossible"}))
|
||||
if buff.String() != "2 != 1\ntask: optional precondition not met\n" {
|
||||
t.Errorf("Wrong output message: %s", buff.String())
|
||||
}
|
||||
buff.Reset()
|
||||
|
||||
// If a precondition has ignore errors, then it will allow tasks calling it to execute
|
||||
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "executes_failing_task_as_cmd_but_succeeds"}))
|
||||
if buff.String() != "2 != 1\ntask: optional precondition not met\n" {
|
||||
t.Errorf("Wrong output message: %s", buff.String())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestGenerates(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user