diff --git a/task_test.go b/task_test.go index f727b776..2cc5f8a6 100644 --- a/task_test.go +++ b/task_test.go @@ -1965,4 +1965,26 @@ func TestSilence(t *testing.T) { require.Empty(t, buff.String(), "While running task-test-chatty-calls-silenced-cmd: Expected not to see output. While the task itself is not silenced, its call to the chatty task is silent.") buff.Reset() + + // Then test calls via dependencies. + // A silent task that depends on a chatty task. + err = e.Run(context.Background(), taskfile.Call{Task: "task-test-is-silent-depends-on-chatty-non-silenced"}) + require.NoError(t, err) + require.NotEmpty(t, buff.String(), "While running task-test-is-silent-depends-on-chatty-non-silenced: Expected to see output. The task is silent and depends on a chatty task. Dependencies does not inherit silence.") + + buff.Reset() + + // A silent task that depends on a silenced chatty task. + err = e.Run(context.Background(), taskfile.Call{Task: "task-test-is-silent-depends-on-chatty-silenced"}) + require.NoError(t, err) + require.Empty(t, buff.String(), "While running task-test-is-silent-depends-on-chatty-silenced: Expected not to see output. The task is silent and has a silenced dependency on a chatty task.") + + buff.Reset() + + // A chatty task that, depends on a silenced chatty task. + err = e.Run(context.Background(), taskfile.Call{Task: "task-test-is-chatty-depends-on-chatty-silenced"}) + require.NoError(t, err) + require.Empty(t, buff.String(), "While running task-test-is-chatty-depends-on-chatty-silenced: Expected not to see output. The task is chatty but does not have commands and has a silenced dependency on a chatty task.") + + buff.Reset() } diff --git a/testdata/silent/Taskfile.yml b/testdata/silent/Taskfile.yml index ad9267e0..2cc9468f 100644 --- a/testdata/silent/Taskfile.yml +++ b/testdata/silent/Taskfile.yml @@ -48,3 +48,24 @@ tasks: cmds: - cmd: exit 0 silent: true + + # Now test with dependencies. + task-test-is-silent-depends-on-chatty-non-silenced: + silent: true + deps: [chatty, silent] + + task-test-is-silent-depends-on-chatty-silenced: + silent: true + deps: + - task: chatty + silent: true + - task: silent + silent: false + + task-test-is-chatty-depends-on-chatty-silenced: + silent: false + deps: + - task: chatty + silent: true + - task: silent + silent: false