1
0
mirror of https://github.com/go-task/task.git synced 2025-02-03 13:22:11 +02:00

feat: make it possible to silence dependencies (#680)

This commit is contained in:
Mads H. Danquah 2023-04-27 08:28:04 +02:00 committed by Andrey Nering
parent 9a406f5998
commit 8bc98fedbf
2 changed files with 43 additions and 0 deletions

View File

@ -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()
}

View File

@ -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