Skip to content

Commit 6ff2d90

Browse files
committed
test(snapshots): migrate vp-* cases to the PTY snapshot suite
Migrates the 10 `vp-*` cases (build/run/fmt/lint/pack cache behavior) from packages/cli/snap-tests to the PTY snapshot suite, and removes the legacy dirs. Six build-cache cases used `vp run/build 2>&1 | grep 'cache hit/miss/disabled'` shell pipes the migrator cannot translate; converted each to run the command directly and let the snapshot capture the full combined output, so the cache-status line is asserted by the snapshot (stricter than the old grep). Part of #2116.
1 parent 9247583 commit 6ff2d90

78 files changed

Lines changed: 557 additions & 257 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/cli/snap-tests/vp-build-auto-output-restoration/index.html renamed to crates/vite_cli_snapshots/tests/cli_snapshots/fixtures/vp_build_auto_output_restoration/index.html

File renamed without changes.

packages/cli/snap-tests/vp-build-auto-output-restoration/package.json renamed to crates/vite_cli_snapshots/tests/cli_snapshots/fixtures/vp_build_auto_output_restoration/package.json

File renamed without changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[[case]]
2+
name = "vp_build_auto_output_restoration"
3+
vp = "local"
4+
steps = [
5+
{ argv = ["vp", "run", "build"], comment = "first build populates the cache", snapshot = false, continue-on-failure = true },
6+
{ argv = ["vpt", "list-dir", "dist"], comment = "build output exists", continue-on-failure = true },
7+
{ argv = ["vpt", "rm", "-rf", "dist"], comment = "remove the build output", continue-on-failure = true },
8+
{ argv = ["vp", "run", "build"], comment = "rebuild hits cache", continue-on-failure = true },
9+
{ argv = ["vpt", "list-dir", "dist"], comment = "dist auto-restored on cache hit (no synthetic output config)", continue-on-failure = true },
10+
]
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# vp_build_auto_output_restoration
2+
3+
## `vp run build`
4+
5+
first build populates the cache
6+
7+
8+
## `vpt list-dir dist`
9+
10+
build output exists
11+
12+
```
13+
assets
14+
index.html
15+
```
16+
17+
## `vpt rm -rf dist`
18+
19+
remove the build output
20+
21+
```
22+
```
23+
24+
## `vp run build`
25+
26+
rebuild hits cache
27+
28+
```
29+
$ vp build ◉ cache hit, replaying
30+
vite <version> building client environment for production...
31+
transforming...✓ 4 modules transformed.
32+
rendering chunks...
33+
computing gzip size...
34+
dist/index.html <size> kB │ gzip: <size> kB
35+
dist/assets/index-<hash>.js <size> kB │ gzip: <size> kB
36+
37+
✓ built in <duration>
38+
39+
---
40+
vp run: cache hit, <duration> saved.
41+
```
42+
43+
## `vpt list-dir dist`
44+
45+
dist auto-restored on cache hit (no synthetic output config)
46+
47+
```
48+
assets
49+
index.html
50+
```

packages/cli/snap-tests/vp-build-auto-output-restoration/vite.config.ts renamed to crates/vite_cli_snapshots/tests/cli_snapshots/fixtures/vp_build_auto_output_restoration/vite.config.ts

File renamed without changes.

packages/cli/snap-tests/vp-build-auto-tracked-env/index.html renamed to crates/vite_cli_snapshots/tests/cli_snapshots/fixtures/vp_build_auto_tracked_env/index.html

File renamed without changes.

packages/cli/snap-tests/vp-build-auto-tracked-env/package.json renamed to crates/vite_cli_snapshots/tests/cli_snapshots/fixtures/vp_build_auto_tracked_env/package.json

File renamed without changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[[case]]
2+
name = "vp_build_auto_tracked_env"
3+
vp = "local"
4+
steps = [
5+
{ argv = ["vp", "run", "build"], comment = "first build", envs = [["VITE_GREETING", "hello"]], continue-on-failure = true },
6+
{ argv = ["vp", "run", "build"], comment = "same env, cache hit", envs = [["VITE_GREETING", "hello"]], continue-on-failure = true },
7+
{ argv = ["vp", "run", "build"], comment = "VITE_ env changed, cache miss (tracked via vite-task-client)", envs = [["VITE_GREETING", "world"]], continue-on-failure = true },
8+
]
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# vp_build_auto_tracked_env
2+
3+
## `VITE_GREETING=hello vp run build`
4+
5+
first build
6+
7+
```
8+
$ vp build
9+
vite <version> building client environment for production...
10+
transforming...✓ 4 modules transformed.
11+
rendering chunks...
12+
computing gzip size...
13+
dist/index.html <size> kB │ gzip: <size> kB
14+
dist/assets/index-<hash>.js <size> kB │ gzip: <size> kB
15+
16+
✓ built in <duration>
17+
```
18+
19+
## `VITE_GREETING=hello vp run build`
20+
21+
same env, cache hit
22+
23+
```
24+
$ vp build ◉ cache hit, replaying
25+
vite <version> building client environment for production...
26+
transforming...✓ 4 modules transformed.
27+
rendering chunks...
28+
computing gzip size...
29+
dist/index.html <size> kB │ gzip: <size> kB
30+
dist/assets/index-<hash>.js <size> kB │ gzip: <size> kB
31+
32+
✓ built in <duration>
33+
34+
---
35+
vp run: cache hit, <duration> saved.
36+
```
37+
38+
## `VITE_GREETING=world vp run build`
39+
40+
VITE_ env changed, cache miss (tracked via vite-task-client)
41+
42+
```
43+
$ vp build ○ cache miss: env 'VITE_GREETING' changed, executing
44+
vite <version> building client environment for production...
45+
transforming...✓ 4 modules transformed.
46+
rendering chunks...
47+
computing gzip size...
48+
dist/index.html <size> kB │ gzip: <size> kB
49+
dist/assets/index-<hash>.js <size> kB │ gzip: <size> kB
50+
51+
✓ built in <duration>
52+
```

packages/cli/snap-tests/vp-build-auto-tracked-env/vite.config.ts renamed to crates/vite_cli_snapshots/tests/cli_snapshots/fixtures/vp_build_auto_tracked_env/vite.config.ts

File renamed without changes.

0 commit comments

Comments
 (0)