Skip to content

Commit e6def81

Browse files
committed
update
1 parent 477f6d7 commit e6def81

10 files changed

+66
-40
lines changed

crates/vite_task_graph/tests/fixtures/transitive-dependency-workspace/cli-queries.toml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@ args = ["build"]
1010

1111
[[query]]
1212
name = "explicit package name under different package"
13-
cwd = "packages/b"
14-
args = ["@test/a#build"]
13+
cwd = "packages/a"
14+
args = ["@test/c#build"]
1515

1616
[[query]]
1717
name = "explicit package name under non-package cwd"
1818
cwd = ""
19+
args = ["@test/c#build"]
20+
21+
[[query]]
22+
name = "ambiguous task name"
23+
cwd = ""
1924
args = ["@test/a#build"]
2025

2126
[[query]]
@@ -33,6 +38,11 @@ name = "transitive in package without the task"
3338
cwd = "packages/a"
3439
args = ["--transitive", "lint"]
3540

41+
[[query]]
42+
name = "transitive non existent task"
43+
cwd = "packages/a"
44+
args = ["--transitive", "non-existent-task"]
45+
3646
[[query]]
3747
name = "recursive"
3848
cwd = ""
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "@test/a",
3+
"version": "1.0.0",
4+
"scripts": {
5+
"build": "echo Building another A"
6+
}
7+
}

crates/vite_task_graph/tests/fixtures/transitive-dependency-workspace/packages/another-c/package.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

crates/vite_task_graph/tests/snapshots.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ fn run_case(runtime: &Runtime, tmpdir: &AbsolutePath, case_path: &Path) {
178178
)
179179
.await
180180
.expect(&format!("Failed to load task graph for case {case_name}"));
181+
181182
let task_graph_snapshot = snapshot_task_graph(&indexed_task_graph, &case_stage_path);
183+
insta::assert_json_snapshot!("task graph", task_graph_snapshot);
182184

183185
for cli_query in cli_queries_file.queries {
184186
let snapshot_name = format!("query - {}", cli_query.name);
@@ -205,18 +207,15 @@ fn run_case(runtime: &Runtime, tmpdir: &AbsolutePath, case_path: &Path) {
205207
Ok(ok) => ok,
206208
Err(mut err) => {
207209
stablize_specifier_lookup_error(&mut err, &case_stage_path);
208-
insta::assert_snapshot!(snapshot_name, err);
210+
insta::assert_debug_snapshot!(snapshot_name, err);
209211
continue;
210212
}
211213
};
212214

213215
let execution_graph_snapshot =
214216
snapshot_execution_graph(&execution_graph, &indexed_task_graph, &case_stage_path);
215-
216217
insta::assert_json_snapshot!(snapshot_name, execution_graph_snapshot);
217218
}
218-
219-
insta::assert_json_snapshot!("task graph", task_graph_snapshot);
220219
});
221220
}
222221

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
source: crates/vite_task_graph/tests/snapshots.rs
3+
expression: err
4+
input_file: crates/vite_task_graph/tests/fixtures/transitive-dependency-workspace
5+
---
6+
AmbiguousPackageName {
7+
package_name: "@test/a",
8+
package_paths: [
9+
AbsolutePath(
10+
"/workspace/packages/a",
11+
),
12+
AbsolutePath(
13+
"/workspace/packages/another-a",
14+
),
15+
],
16+
}

crates/vite_task_graph/tests/snapshots/snapshots__query - explicit package name under different package@transitive-dependency-workspace.snap

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,9 @@ input_file: crates/vite_task_graph/tests/fixtures/transitive-dependency-workspac
66
[
77
{
88
"task": {
9-
"package_dir": "packages/a",
9+
"package_dir": "packages/c",
1010
"task_name": "build"
1111
},
12-
"deps": [
13-
{
14-
"package_dir": "packages/a",
15-
"task_name": "test"
16-
}
17-
]
18-
},
19-
{
20-
"task": {
21-
"package_dir": "packages/a",
22-
"task_name": "test"
23-
},
2412
"deps": []
2513
}
2614
]

crates/vite_task_graph/tests/snapshots/snapshots__query - explicit package name under non-package cwd@transitive-dependency-workspace.snap

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,9 @@ input_file: crates/vite_task_graph/tests/fixtures/transitive-dependency-workspac
66
[
77
{
88
"task": {
9-
"package_dir": "packages/a",
9+
"package_dir": "packages/c",
1010
"task_name": "build"
1111
},
12-
"deps": [
13-
{
14-
"package_dir": "packages/a",
15-
"task_name": "test"
16-
}
17-
]
18-
},
19-
{
20-
"task": {
21-
"package_dir": "packages/a",
22-
"task_name": "test"
23-
},
2412
"deps": []
2513
}
2614
]

crates/vite_task_graph/tests/snapshots/snapshots__query - recursive@transitive-dependency-workspace.snap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ input_file: crates/vite_task_graph/tests/fixtures/transitive-dependency-workspac
3131
},
3232
"deps": []
3333
},
34+
{
35+
"task": {
36+
"package_dir": "packages/another-a",
37+
"task_name": "build"
38+
},
39+
"deps": []
40+
},
3441
{
3542
"task": {
3643
"package_dir": "packages/b2",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
source: crates/vite_task_graph/tests/snapshots.rs
3+
expression: err
4+
input_file: crates/vite_task_graph/tests/fixtures/transitive-dependency-workspace
5+
---
6+
TaskNameNotFound {
7+
package_name: "@test/a",
8+
task_name: "non-existent-task",
9+
package_index: NodeIndex(PackageIx(0)),
10+
}

crates/vite_task_graph/tests/snapshots/snapshots__task graph@transitive-dependency-workspace.snap

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ input_file: crates/vite_task_graph/tests/fixtures/transitive-dependency-workspac
4444
"cwd": "packages/a",
4545
"depends_on": []
4646
},
47+
{
48+
"id": {
49+
"package_dir": "packages/another-a",
50+
"task_name": "build"
51+
},
52+
"command": "echo Building another A",
53+
"cwd": "packages/another-a",
54+
"depends_on": []
55+
},
4756
{
4857
"id": {
4958
"package_dir": "packages/b1",

0 commit comments

Comments
 (0)