diff --git a/precondition.go b/precondition.go index 3f2f066b..eff123a0 100644 --- a/precondition.go +++ b/precondition.go @@ -22,7 +22,7 @@ func (e *Executor) areTaskPreconditionsMet(ctx context.Context, t *taskfile.Task }) if err != nil { - e.Logger.Outf("task: %s", p.Msg) + e.Logger.Errf("task: %s", p.Msg) return false, ErrPreconditionFailed } } diff --git a/task_test.go b/task_test.go index 79568abd..d42325c2 100644 --- a/task_test.go +++ b/task_test.go @@ -293,7 +293,7 @@ func TestPrecondition(t *testing.T) { // A precondition that was not met assert.Error(t, e.Run(context.Background(), taskfile.Call{Task: "impossible"})) - if buff.String() != "1 != 0\n" { + if buff.String() != "task: 1 != 0 obviously!\n" { t.Errorf("Wrong output message: %s", buff.String()) } buff.Reset() @@ -301,14 +301,14 @@ 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\ntask: precondition not met\n" { + if buff.String() != "task: 1 != 0 obviously!\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\ntask: precondition not met\n" { + if buff.String() != "task: 1 != 0 obviously!\n" { t.Errorf("Wrong output message: %s", buff.String()) } buff.Reset() diff --git a/testdata/precondition/Taskfile.yml b/testdata/precondition/Taskfile.yml index b9f2c338..405140f7 100644 --- a/testdata/precondition/Taskfile.yml +++ b/testdata/precondition/Taskfile.yml @@ -8,7 +8,7 @@ tasks: impossible: preconditions: - sh: "[ 1 = 0 ]" - msg: "1 != 0" + msg: "1 != 0 obviously!" depends_on_imposssible: deps: @@ -17,7 +17,3 @@ tasks: executes_failing_task_as_cmd: cmds: - task: impossible - - depends_on_failure_of_impossible: - deps: - - impossible_but_i_dont_care