mirror of
https://github.com/go-task/task.git
synced 2026-07-08 06:28:44 +00:00
fix: reject include without taskfile or dir (#2892)
Co-authored-by: Valentin Maerten <maerten.valentin@gmail.com>
This commit is contained in:
19
task_test.go
19
task_test.go
@@ -1240,6 +1240,25 @@ func TestIncludesIncorrect(t *testing.T) {
|
||||
assert.Contains(t, err.Error(), "Failed to parse testdata/includes_incorrect/incomplete.yml:", err.Error())
|
||||
}
|
||||
|
||||
func TestIncludesMissingTaskfile(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
const dir = "testdata/includes_missing_taskfile"
|
||||
|
||||
var buff bytes.Buffer
|
||||
e := task.NewExecutor(
|
||||
task.WithDir(dir),
|
||||
task.WithStdout(&buff),
|
||||
task.WithStderr(&buff),
|
||||
task.WithSilent(true),
|
||||
)
|
||||
|
||||
err := e.Setup()
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "include must specify taskfile or dir")
|
||||
assert.NotContains(t, err.Error(), "include cycle detected")
|
||||
}
|
||||
|
||||
func TestIncludesEmptyMain(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user