mirror of
https://github.com/go-task/task.git
synced 2025-08-08 22:36:57 +02:00
fix(watcher): fix some v3.43.x regressions (#2271)
This commit is contained in:
@@ -31,16 +31,17 @@ task: Started watching for tasks: default
|
||||
task: [default] echo "Task running!"
|
||||
Task running!
|
||||
task: task "default" finished running
|
||||
task: Task "default" is up to date
|
||||
task: [default] echo "Task running!"
|
||||
Task running!
|
||||
task: task "default" finished running
|
||||
`)
|
||||
|
||||
var buff bytes.Buffer
|
||||
e := task.NewExecutor(
|
||||
task.ExecutorWithDir(dir),
|
||||
task.ExecutorWithStdout(&buff),
|
||||
task.ExecutorWithStderr(&buff),
|
||||
task.ExecutorWithWatch(true),
|
||||
task.WithDir(dir),
|
||||
task.WithStdout(&buff),
|
||||
task.WithStderr(&buff),
|
||||
task.WithWatch(true),
|
||||
)
|
||||
|
||||
require.NoError(t, e.Setup())
|
||||
@@ -71,16 +72,16 @@ task: task "default" finished running
|
||||
}
|
||||
}()
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
err = os.WriteFile(filePath, []byte("test updated"), 0o644)
|
||||
require.NoError(t, err)
|
||||
|
||||
time.Sleep(150 * time.Millisecond)
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
cancel()
|
||||
assert.Equal(t, expectedOutput, strings.TrimSpace(buff.String()))
|
||||
}
|
||||
|
||||
func TestShouldIgnoreFile(t *testing.T) {
|
||||
func TestShouldIgnore(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tt := []struct {
|
||||
@@ -95,7 +96,7 @@ func TestShouldIgnoreFile(t *testing.T) {
|
||||
ct := ct
|
||||
t.Run(fmt.Sprintf("ignore - %d", k), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
require.Equal(t, task.ShouldIgnoreFile(ct.path), ct.expect)
|
||||
require.Equal(t, task.ShouldIgnore(ct.path), ct.expect)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user