Skip to content

Commit e0f77ee

Browse files
committed
test: redact installer version in snapshots
1 parent 13cbc7b commit e0f77ee

7 files changed

Lines changed: 32 additions & 10 deletions

File tree

‎crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/download_progress/snapshots/installation_progress_ci.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
```
66
Before installation: preserve this output.
7-
info: installing vite-plus@0.3.3...
7+
info: installing vite-plus@<version>...
88
info: Preparing Node.js and pnpm...
99
info: Installing dependencies...
1010
✓ Dependencies installed.

‎crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/download_progress/snapshots/installation_progress_failure.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
```
88
Before installation: preserve this output.
9-
info: installing vite-plus@0.3.3...
9+
info: installing vite-plus@<version>...
1010
⠿ Preparing Node.js and pnpm... <duration>
1111
```
1212

@@ -16,7 +16,7 @@ info: installing vite-plus@0.3.3...
1616

1717
```
1818
Before installation: preserve this output.
19-
info: installing vite-plus@0.3.3...
19+
info: installing vite-plus@<version>...
2020
⠿ Downloading pnpm <version>... <size> B (<size> B/s)
2121
```
2222

@@ -26,15 +26,15 @@ info: installing vite-plus@0.3.3...
2626

2727
```
2828
Before installation: preserve this output.
29-
info: installing vite-plus@0.3.3...
29+
info: installing vite-plus@<version>...
3030
⠿ Installing dependencies... <duration>
3131
```
3232

3333
**← write-key:** `enter`
3434

3535
```
3636
Before installation: preserve this output.
37-
info: installing vite-plus@0.3.3...
37+
info: installing vite-plus@<version>...
3838
error: Setup error: Failed to install production dependencies (exit code: 17). See log for details: <workspace>/home/upgrade.log
3939
Failure log preserves pnpm stdout and stderr.
4040
After installation.

‎crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/download_progress/snapshots/installation_progress_interactive.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
```
88
Before installation: preserve this output.
9-
info: installing vite-plus@0.3.3...
9+
info: installing vite-plus@<version>...
1010
⠿ Preparing Node.js and pnpm... <duration>
1111
```
1212

@@ -16,7 +16,7 @@ info: installing vite-plus@0.3.3...
1616

1717
```
1818
Before installation: preserve this output.
19-
info: installing vite-plus@0.3.3...
19+
info: installing vite-plus@<version>...
2020
⠿ Downloading pnpm <version>... <size> B (<size> B/s)
2121
```
2222

@@ -26,15 +26,15 @@ info: installing vite-plus@0.3.3...
2626

2727
```
2828
Before installation: preserve this output.
29-
info: installing vite-plus@0.3.3...
29+
info: installing vite-plus@<version>...
3030
⠿ Installing dependencies... <duration>
3131
```
3232

3333
**← write-key:** `enter`
3434

3535
```
3636
Before installation: preserve this output.
37-
info: installing vite-plus@0.3.3...
37+
info: installing vite-plus@<version>...
3838
✓ Dependencies installed.
3939
Setup:
4040
Preparing vite-plus environment.

‎crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/download_progress/snapshots/installation_progress_non_tty.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Before installation: preserve this output.
77
Bootstrap stdout contains only shell assignments.
88
After installation.
9-
info: installing vite-plus@0.3.3...
9+
info: installing vite-plus@<version>...
1010
info: Preparing Node.js and pnpm...
1111
info: Installing dependencies...
1212
✓ Dependencies installed.

‎crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/redaction/snapshots.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ stems, https:// URLs) survive.
1010
steps = [
1111
{ argv = ["vpt", "print-native-path", "src/index.ts", "dist/assets/app.js"], comment = "prints OS-native separators; the snapshot must show forward slashes on every OS" },
1212
{ argv = ["vpt", "print", "dist/assets/index-Dra_-aT4.js 0.71 kB / gzip: 0.40 kB / total 1 MB"], comment = "sizes and hash suffixes are masked" },
13+
{ argv = ["vpt", "print", "info: installing vite-plus@9.8.7-rc.6..."], comment = "standalone installer versions are masked" },
1314
{ argv = ["vpt", "print", "keep vite-tsconfig.js and https://viteplus.dev/guide/ intact"], comment = "lowercase 8-letter stems and URLs survive redaction" },
1415
]

‎crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/redaction/snapshots/redaction_selftest.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ sizes and hash suffixes are masked
2222
dist/assets/index-<hash>.js <size> kB / gzip: <size> kB / total <size> MB
2323
```
2424

25+
## `vpt print 'info: installing vite-plus@9.8.7-rc.6...'`
26+
27+
standalone installer versions are masked
28+
29+
```
30+
info: installing vite-plus@<version>...
31+
```
32+
2533
## `vpt print 'keep vite-tsconfig.js and https://viteplus.dev/guide/ intact'`
2634

2735
lowercase 8-letter stems and URLs survive redaction

‎crates/vp_cli_snapshots/tests/cli_snapshots/redact.rs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@ static VP_VERSION_RE: LazyLock<regex::Regex> = LazyLock::new(|| {
120120
)
121121
.unwrap()
122122
});
123+
// Standalone installation progress prints the release version in
124+
// `info: installing vite-plus@0.3.3...`. The value changes for every release,
125+
// so mask only this status-line context and keep other `vite-plus@<version>`
126+
// output available for assertions.
127+
static VP_INSTALL_VERSION_RE: LazyLock<regex::Regex> = LazyLock::new(|| {
128+
regex::Regex::new(
129+
r"(installing vite-plus@)\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?",
130+
)
131+
.unwrap()
132+
});
123133
// `vp create`/`vp migrate` pin the exact resolved runtime and package-manager
124134
// version into a scaffolded manifest's `devEngines` block (`{ "name": "yarn",
125135
// "version": "4.17.0", ... }`, likewise pnpm/bun/node). Those track whatever
@@ -539,6 +549,9 @@ pub fn redact_output(
539549
// (see VP_VERSION_RE), which bumps on every release.
540550
output = VP_VERSION_RE.replace_all(&output, "${1}<version>").into_owned();
541551

552+
// Redact the release version in standalone installation progress output.
553+
output = VP_INSTALL_VERSION_RE.replace_all(&output, "${1}<version>").into_owned();
554+
542555
// Redact scaffolded devEngines runtime/package-manager pins by name
543556
// context (see DEV_ENGINES_VERSION_RE), which track upstream releases.
544557
output = DEV_ENGINES_VERSION_RE.replace_all(&output, "${1}<version>").into_owned();

0 commit comments

Comments
 (0)