mirror of
https://github.com/go-task/task.git
synced 2026-07-07 22:18:47 +00:00
feat(scoped): refactor compiler, add nested includes, document flatten
Refactor compiler.go for better maintainability: - Extract isScopedMode() helper function - Split getVariables() into getScopedVariables() and getLegacyVariables() - Fix directory resolution: parent chain env/vars now resolve from their own directory instead of the current task's directory Add nested includes support and tests: - Add testdata/scoped_taskfiles/inc_a/nested/Taskfile.yml (3 levels deep) - Add test case for nested include inheritance (root → a → nested) - Verify nested includes inherit vars from full parent chain Fix flaky tests: - Remove VAR from print tasks (defined in both inc_a and inc_b) - Test only unique variables (UNIQUE_A, UNIQUE_B, ROOT_VAR) Document flatten: true escape hatch: - Add migration guide step for using flatten: true - Add new section explaining flatten bypasses scoping - Include example and usage recommendations
This commit is contained in:
@@ -1281,5 +1281,15 @@ func TestScopedTaskfiles(t *testing.T) {
|
||||
),
|
||||
WithTask("call-with-vars"),
|
||||
)
|
||||
// Test nested includes (3 levels: root → a → nested)
|
||||
// Verifies that nested includes inherit vars from their parent chain
|
||||
NewExecutorTest(t,
|
||||
WithName("nested"),
|
||||
WithExecutorOptions(
|
||||
task.WithDir("testdata/scoped_taskfiles"),
|
||||
task.WithSilent(true),
|
||||
),
|
||||
WithTask("a:nested:print"),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user