Skip to content

Commit ebb616f

Browse files
branchseerclaude
andcommitted
test: add e2e snapshots for workspace root skip and prune rules
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 40c3c6c commit ebb616f

File tree

8 files changed

+78
-0
lines changed

8 files changed

+78
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "test-workspace",
3+
"private": true,
4+
"scripts": {
5+
"build": "vp run -r build"
6+
}
7+
}
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-a"
6+
}
7+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "@test/b",
3+
"version": "1.0.0",
4+
"scripts": {
5+
"build": "echo building-b"
6+
},
7+
"dependencies": {
8+
"@test/a": "workspace:*"
9+
}
10+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
packages:
2+
- 'packages/*'
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Tests that workspace root self-referencing tasks don't cause infinite recursion.
2+
# Root build = `vp run -r build` (delegates to all packages recursively).
3+
#
4+
# Skip rule: `vp run -r build` from root produces the same query as the
5+
# nested `vp run -r build` in root's script, so root's expansion is skipped.
6+
# Only packages a and b actually run.
7+
#
8+
# Prune rule: `vp run build` from root produces a ContainingPackage query,
9+
# but root's script `vp run -r build` produces an All query. The queries
10+
# differ so the skip rule doesn't fire. Instead the prune rule removes root
11+
# from the nested result, leaving only a and b.
12+
13+
[[e2e]]
14+
name = "recursive build skips root self-reference"
15+
steps = [
16+
"vp run -r build # only a and b run, root is skipped",
17+
]
18+
19+
[[e2e]]
20+
name = "build from root prunes root from nested expansion"
21+
steps = [
22+
"vp run build # only a and b run under root, root is pruned",
23+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
source: crates/vite_task_bin/tests/e2e_snapshots/main.rs
3+
expression: e2e_outputs
4+
---
5+
> vp run build # only a and b run under root, root is pruned
6+
~/packages/a$ echo building-acache disabled
7+
building-a
8+
9+
~/packages/b$ echo building-bcache disabled
10+
building-b
11+
12+
---
13+
[vp run] 0/2 cache hit (0%). (Run `vp run --last-details` for full details)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
source: crates/vite_task_bin/tests/e2e_snapshots/main.rs
3+
expression: e2e_outputs
4+
---
5+
> vp run -r build # only a and b run, root is skipped
6+
~/packages/a$ echo building-acache disabled
7+
building-a
8+
9+
~/packages/b$ echo building-bcache disabled
10+
building-b
11+
12+
---
13+
[vp run] 0/2 cache hit (0%). (Run `vp run --last-details` for full details)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"cache": true
3+
}

0 commit comments

Comments
 (0)