Skip to content

Commit 11b90cf

Browse files
committed
test: prove --cache propagation to nested scripts with default config
Change nested-cache-override fixture from `"cache": true` to default config (scripts: false, tasks: true). This makes the tests more meaningful since scripts aren't cached by default. Add "outer --cache propagates to nested run without flags" test case to verify that `vp run --cache outer` where outer runs `vp run inner` correctly caches the inner script despite scripts being off globally. https://claude.ai/code/session_01AYbt3E5j8Adk9NB7Sprkah
1 parent 0159145 commit 11b90cf

4 files changed

Lines changed: 123 additions & 29 deletions

File tree

crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ args = ["run", "outer-cache"]
1515
name = "nested run without flags inherits parent cache"
1616
args = ["run", "outer-inherit"]
1717

18+
# Outer --cache propagates to nested run without flags
19+
[[plan]]
20+
name = "outer --cache propagates to nested run without flags"
21+
args = ["run", "--cache", "outer-inherit"]
22+
1823
# Outer --no-cache with nested --cache: inner overrides outer
1924
[[plan]]
2025
name = "outer --no-cache does not propagate into nested --cache"

crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested run without flags inherits parent cache.snap

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -59,34 +59,7 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-ove
5959
"kind": {
6060
"Leaf": {
6161
"Spawn": {
62-
"cache_metadata": {
63-
"spawn_fingerprint": {
64-
"cwd": "",
65-
"program_fingerprint": {
66-
"OutsideWorkspace": {
67-
"program_name": "print-file"
68-
}
69-
},
70-
"args": [
71-
"package.json"
72-
],
73-
"env_fingerprints": {
74-
"fingerprinted_envs": {},
75-
"pass_through_env_config": [
76-
"<default pass-through envs>"
77-
]
78-
},
79-
"fingerprint_ignores": null
80-
},
81-
"execution_cache_key": {
82-
"UserTask": {
83-
"task_name": "inner",
84-
"and_item_index": 0,
85-
"extra_args": [],
86-
"package_path": ""
87-
}
88-
}
89-
},
62+
"cache_metadata": null,
9063
"spawn_command": {
9164
"program_path": "<tools>/node_modules/.bin/print-file",
9265
"args": [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
---
2+
source: crates/vite_task_plan/tests/plan_snapshots/main.rs
3+
expression: "&plan_json"
4+
info:
5+
args:
6+
- run
7+
- "--cache"
8+
- outer-inherit
9+
input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override
10+
---
11+
[
12+
{
13+
"key": [
14+
"<workspace>/",
15+
"outer-inherit"
16+
],
17+
"node": {
18+
"task_display": {
19+
"package_name": "@test/nested-cache-override",
20+
"task_name": "outer-inherit",
21+
"package_path": "<workspace>/"
22+
},
23+
"items": [
24+
{
25+
"execution_item_display": {
26+
"task_display": {
27+
"package_name": "@test/nested-cache-override",
28+
"task_name": "outer-inherit",
29+
"package_path": "<workspace>/"
30+
},
31+
"command": "vp run inner",
32+
"and_item_index": null,
33+
"cwd": "<workspace>/"
34+
},
35+
"kind": {
36+
"Expanded": [
37+
{
38+
"key": [
39+
"<workspace>/",
40+
"inner"
41+
],
42+
"node": {
43+
"task_display": {
44+
"package_name": "@test/nested-cache-override",
45+
"task_name": "inner",
46+
"package_path": "<workspace>/"
47+
},
48+
"items": [
49+
{
50+
"execution_item_display": {
51+
"task_display": {
52+
"package_name": "@test/nested-cache-override",
53+
"task_name": "inner",
54+
"package_path": "<workspace>/"
55+
},
56+
"command": "print-file package.json",
57+
"and_item_index": null,
58+
"cwd": "<workspace>/"
59+
},
60+
"kind": {
61+
"Leaf": {
62+
"Spawn": {
63+
"cache_metadata": {
64+
"spawn_fingerprint": {
65+
"cwd": "",
66+
"program_fingerprint": {
67+
"OutsideWorkspace": {
68+
"program_name": "print-file"
69+
}
70+
},
71+
"args": [
72+
"package.json"
73+
],
74+
"env_fingerprints": {
75+
"fingerprinted_envs": {},
76+
"pass_through_env_config": [
77+
"<default pass-through envs>"
78+
]
79+
},
80+
"fingerprint_ignores": null
81+
},
82+
"execution_cache_key": {
83+
"UserTask": {
84+
"task_name": "inner",
85+
"and_item_index": 0,
86+
"extra_args": [],
87+
"package_path": ""
88+
}
89+
}
90+
},
91+
"spawn_command": {
92+
"program_path": "<tools>/node_modules/.bin/print-file",
93+
"args": [
94+
"package.json"
95+
],
96+
"all_envs": {
97+
"NO_COLOR": "1",
98+
"PATH": "<workspace>/node_modules/.bin:<tools>/node_modules/.bin"
99+
},
100+
"cwd": "<workspace>/"
101+
}
102+
}
103+
}
104+
}
105+
}
106+
]
107+
},
108+
"neighbors": []
109+
}
110+
]
111+
}
112+
}
113+
]
114+
},
115+
"neighbors": []
116+
}
117+
]
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
{
2-
"cache": true
32
}

0 commit comments

Comments
 (0)