Skip to content

Commit 19027aa

Browse files
wan9chiclaude
andcommitted
test(plan): consolidate array cd snapshots into a single fixture
Replaces `array_cd_spawn`, `array_cd_shell`, `array_shell_cd_before_next`, and `array_compound_cd_before_next` with one `array_cd` fixture (`["vtt print before_cd", "cd snapshots && vtt print after_cd", "vtt print after_cd2"]`). The new fixture verifies in one snapshot that: - the first array element runs at the original cwd, - `cd` as the first `&&`-and-item mutates cwd and produces no item, - the cwd mutation persists into the next array element. The compound/shell `cd` detection still has unit coverage in `vite_shell::tests::test_shell_command_may_change_cwd_*`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 7e96744 commit 19027aa

7 files changed

Lines changed: 101 additions & 510 deletions

File tree

crates/vite_task_plan/tests/plan_snapshots/fixtures/task_command_shorthands/snapshots.toml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,8 @@ name = "nested_vt_array"
1515
args = ["run", "nested_vt_array"]
1616

1717
[[plan]]
18-
name = "array_cd_spawn"
19-
args = ["run", "array_cd_spawn"]
20-
21-
[[plan]]
22-
name = "array_cd_shell"
23-
args = ["run", "array_cd_shell"]
24-
25-
[[plan]]
26-
name = "array_shell_cd_before_next"
27-
args = ["run", "array_shell_cd_before_next"]
28-
29-
[[plan]]
30-
name = "array_compound_cd_before_next"
31-
args = ["run", "array_compound_cd_before_next"]
18+
name = "array_cd"
19+
args = ["run", "array_cd"]
3220

3321
[[plan]]
3422
name = "array_unbalanced_quotes"

crates/vite_task_plan/tests/plan_snapshots/fixtures/task_command_shorthands/snapshots/query_array_compound_cd_before_next.jsonc renamed to crates/vite_task_plan/tests/plan_snapshots/fixtures/task_command_shorthands/snapshots/query_array_cd.jsonc

Lines changed: 90 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
// run array_compound_cd_before_next
1+
// run array_cd
22
{
33
"graph": [
44
{
55
"key": [
66
"<workspace>/",
7-
"array_compound_cd_before_next"
7+
"array_cd"
88
],
99
"node": {
1010
"task_display": {
1111
"package_name": "@test/task-command-shorthands",
12-
"task_name": "array_compound_cd_before_next",
12+
"task_name": "array_cd",
1313
"package_path": "<workspace>/"
1414
},
1515
"items": [
1616
{
1717
"execution_item_display": {
1818
"task_display": {
1919
"package_name": "@test/task-command-shorthands",
20-
"task_name": "array_compound_cd_before_next",
20+
"task_name": "array_cd",
2121
"package_path": "<workspace>/"
2222
},
23-
"command": "if true; then cd snapshots; fi",
23+
"command": "vtt print before_cd",
2424
"cwd": "<workspace>/"
2525
},
2626
"kind": {
@@ -31,12 +31,12 @@
3131
"cwd": "",
3232
"program_fingerprint": {
3333
"OutsideWorkspace": {
34-
"program_name": "<os_shell_name>"
34+
"program_name": "vtt"
3535
}
3636
},
3737
"args": [
38-
"<os_shell_args>",
39-
"if true; then cd snapshots; fi"
38+
"print",
39+
"before_cd"
4040
],
4141
"env_fingerprints": {
4242
"fingerprinted_envs": {},
@@ -47,7 +47,7 @@
4747
},
4848
"execution_cache_key": {
4949
"UserTask": {
50-
"task_name": "array_compound_cd_before_next",
50+
"task_name": "array_cd",
5151
"command_item_index": 0,
5252
"and_item_index": 0,
5353
"extra_args": [],
@@ -66,10 +66,10 @@
6666
}
6767
},
6868
"spawn_command": {
69-
"program_path": "<os_shell_path>",
69+
"program_path": "<tools>/vtt",
7070
"args": [
71-
"<os_shell_args>",
72-
"if true; then cd snapshots; fi"
71+
"print",
72+
"before_cd"
7373
],
7474
"all_envs": {
7575
"FORCE_COLOR": "1",
@@ -85,26 +85,26 @@
8585
"execution_item_display": {
8686
"task_display": {
8787
"package_name": "@test/task-command-shorthands",
88-
"task_name": "array_compound_cd_before_next",
88+
"task_name": "array_cd",
8989
"package_path": "<workspace>/"
9090
},
91-
"command": "vtt print-file package.json",
92-
"cwd": "<workspace>/"
91+
"command": "vtt print after_cd",
92+
"cwd": "<workspace>/snapshots"
9393
},
9494
"kind": {
9595
"Leaf": {
9696
"Spawn": {
9797
"cache_metadata": {
9898
"spawn_fingerprint": {
99-
"cwd": "",
99+
"cwd": "snapshots",
100100
"program_fingerprint": {
101101
"OutsideWorkspace": {
102102
"program_name": "vtt"
103103
}
104104
},
105105
"args": [
106-
"print-file",
107-
"package.json"
106+
"print",
107+
"after_cd"
108108
],
109109
"env_fingerprints": {
110110
"fingerprinted_envs": {},
@@ -115,8 +115,76 @@
115115
},
116116
"execution_cache_key": {
117117
"UserTask": {
118-
"task_name": "array_compound_cd_before_next",
118+
"task_name": "array_cd",
119119
"command_item_index": 1,
120+
"and_item_index": 1,
121+
"extra_args": [],
122+
"package_path": ""
123+
}
124+
},
125+
"input_config": {
126+
"includes_auto": true,
127+
"positive_globs": [],
128+
"negative_globs": []
129+
},
130+
"output_config": {
131+
"includes_auto": false,
132+
"positive_globs": [],
133+
"negative_globs": []
134+
}
135+
},
136+
"spawn_command": {
137+
"program_path": "<tools>/vtt",
138+
"args": [
139+
"print",
140+
"after_cd"
141+
],
142+
"all_envs": {
143+
"FORCE_COLOR": "1",
144+
"PATH": "<workspace>/node_modules/.bin:<tools>"
145+
},
146+
"cwd": "<workspace>/snapshots"
147+
}
148+
}
149+
}
150+
}
151+
},
152+
{
153+
"execution_item_display": {
154+
"task_display": {
155+
"package_name": "@test/task-command-shorthands",
156+
"task_name": "array_cd",
157+
"package_path": "<workspace>/"
158+
},
159+
"command": "vtt print after_cd2",
160+
"cwd": "<workspace>/snapshots"
161+
},
162+
"kind": {
163+
"Leaf": {
164+
"Spawn": {
165+
"cache_metadata": {
166+
"spawn_fingerprint": {
167+
"cwd": "snapshots",
168+
"program_fingerprint": {
169+
"OutsideWorkspace": {
170+
"program_name": "vtt"
171+
}
172+
},
173+
"args": [
174+
"print",
175+
"after_cd2"
176+
],
177+
"env_fingerprints": {
178+
"fingerprinted_envs": {},
179+
"untracked_env_config": [
180+
"<default untracked envs>"
181+
]
182+
}
183+
},
184+
"execution_cache_key": {
185+
"UserTask": {
186+
"task_name": "array_cd",
187+
"command_item_index": 2,
120188
"and_item_index": 0,
121189
"extra_args": [],
122190
"package_path": ""
@@ -136,14 +204,14 @@
136204
"spawn_command": {
137205
"program_path": "<tools>/vtt",
138206
"args": [
139-
"print-file",
140-
"package.json"
207+
"print",
208+
"after_cd2"
141209
],
142210
"all_envs": {
143211
"FORCE_COLOR": "1",
144212
"PATH": "<workspace>/node_modules/.bin:<tools>"
145213
},
146-
"cwd": "<workspace>/"
214+
"cwd": "<workspace>/snapshots"
147215
}
148216
}
149217
}

crates/vite_task_plan/tests/plan_snapshots/fixtures/task_command_shorthands/snapshots/query_array_cd_shell.jsonc

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

0 commit comments

Comments
 (0)