Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions crates/vp_cli_snapshots/tests/cli_snapshots/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,16 @@ Snapshots are plain-text screen grids: styling is flattened, and redaction
masks paths, durations, versions, UUIDs, thread counts, byte-size numbers
(units kept: `<size> kB`), and content-hash asset suffixes (see
`redact.rs`; sizes and hashes because output bytes differ across OSes). If
a case produces nondeterministic
output, fix it with a milestone or a redaction rule; never rerun until
green. Set
a case produces nondeterministic output, fix it with controlled fixture data,
a milestone, or a redaction rule; never rerun until green. Set
`formatted-snapshot = true` on a step only when the test is about colors.

For registry fallback tests, use `local-registry = true` and a fixture
`mock-manifest.json` entry such as `"npm/latest"` to control the resolved version.
Keep the CLI input unpinned so the fallback is still tested, and keep exact
version assertions. Unmocked registry requests go upstream, so
`local-registry = true` alone does not freeze dist-tags.

Fixture trees are excluded from repo-wide fmt, lint, typecheck, and vitest
(`vite.config.ts`, `tsconfig.json`); recorded snapshots and
`snapshots.toml` are runner metadata and never appear inside the staged
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const assert = require('node:assert/strict');
const { execFileSync } = require('node:child_process');
const manifest = require('./mock-manifest.json');

const installed = JSON.parse(
execFileSync('vp', ['env', 'list', 'npm', '--json'], { encoding: 'utf8' }),
).package_managers.npm;
assert.equal(installed.length, 1);
assert.match(installed[0].version, /^\d+\.\d+\.\d+/);
assert.equal(installed[0].version, manifest['npm/latest'].version);
assert.equal(installed[0].current, false);
assert.equal(installed[0].default, false);
console.log('Standalone npm is installed but is not current');
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"npm/latest": { "name": "npm", "version": "12.1.0" }
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ steps = [
name = "command_env_install_standalone_npm_fallback"
vp = "global"
comment = "Explicit npm installation uses standalone registry npm without installing Node.js."
# Fix the registry's latest response, not the CLI input: this must exercise
# the fallback while remaining independent of future npm releases.
local-registry = true
skip-platforms = ["windows"]
seed-runtime = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Explicit npm installation uses standalone registry npm without installing Node.j
an explicit npm scope exports the standalone npm fallback

```
export VP_NPM_VERSION=12.0.2
export VP_NPM_VERSION=12.1.0
Using npm <version> (resolved from registry fallback)
```

Expand Down
Loading