diff --git a/crates/cli/tests/dep_graph_test.rs b/crates/cli/tests/dep_graph_test.rs index 97cdd69b439..b4cc902b775 100644 --- a/crates/cli/tests/dep_graph_test.rs +++ b/crates/cli/tests/dep_graph_test.rs @@ -42,6 +42,25 @@ fn focused_by_target() { assert_snapshot!(assert.output()); } +#[test] +fn focused_by_task_in_cwd() { + let (workspace_config, toolchain_config, tasks_config) = get_tasks_fixture_configs(); + + let sandbox = create_sandbox_with_config( + "tasks", + Some(workspace_config), + Some(toolchain_config), + Some(tasks_config), + ); + + let assert = sandbox.run_moon(|cmd| { + cmd.arg("dep-graph").arg("--dot").arg("lint"); + cmd.current_dir(sandbox.path().join("basic")); + }); + + assert_snapshot!(assert.output()); +} + #[test] fn includes_dependencies_when_focused() { let (workspace_config, toolchain_config, tasks_config) = get_tasks_fixture_configs(); diff --git a/crates/cli/tests/snapshots/dep_graph_test__focused_by_task_in_cwd.snap b/crates/cli/tests/snapshots/dep_graph_test__focused_by_task_in_cwd.snap new file mode 100644 index 00000000000..97327f0d549 --- /dev/null +++ b/crates/cli/tests/snapshots/dep_graph_test__focused_by_task_in_cwd.snap @@ -0,0 +1,18 @@ +--- +source: crates/cli/tests/dep_graph_test.rs +expression: assert.output() +--- +digraph { + 0 [ label="SyncWorkspace" style=filled, shape=oval, fillcolor=gray, fontcolor=black] + 1 [ label="SetupNodeTool(18.0.0)" style=filled, shape=oval, fillcolor=gray, fontcolor=black] + 2 [ label="InstallNodeDeps(18.0.0)" style=filled, shape=oval, fillcolor=gray, fontcolor=black] + 3 [ label="SyncNodeProject(basic)" style=filled, shape=oval, fillcolor=gray, fontcolor=black] + 4 [ label="RunTarget(basic:lint)" style=filled, shape=oval, fillcolor=gray, fontcolor=black] + 2 -> 1 [ arrowhead=box, arrowtail=box] + 3 -> 1 [ arrowhead=box, arrowtail=box] + 4 -> 2 [ arrowhead=box, arrowtail=box] + 4 -> 3 [ arrowhead=box, arrowtail=box] +} + + + diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 999119b870b..32db7728580 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -10,6 +10,12 @@ - More accurately monitors signals (ctrl+c) and shutdowns. - Tasks can now be configured with a timeout. +## Unreleased + +#### 🚀 Updates + +- Updated `moon dep-graph` to support a task in closest project, similar to `moon run`. + ## 1.14.2 #### 🐞 Fixes