Skip to content

Commit

Permalink
Add tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Sep 29, 2023
1 parent 2062ae6 commit 883674b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
19 changes: 19 additions & 0 deletions crates/cli/tests/dep_graph_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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]
}



6 changes: 6 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 883674b

Please sign in to comment.