Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,27 @@ name = "command_outdated_global"
vp = "global"
skip-platforms = ["windows"]
steps = [
{ argv = ["vp", "install", "-g", "testnpm2@1.0.0"], comment = "should prepare global outdated package", snapshot = false, continue-on-failure = true },
{ argv = ["vp", "install", "-g", "testnpm2@1.0.0"], comment = "should prepare a version-pinned global package", snapshot = false, continue-on-failure = true },
{ argv = ["vp", "outdated", "definitely-not-installed-vite-plus-snap-pkg", "-g", "--format", "json"], comment = "should support empty global json output", continue-on-failure = true },
{ argv = ["vp", "outdated", "testnpm2", "-g", "--format", "json"], comment = "should report a pinned package without a wanted update", continue-on-failure = true },
{ argv = ["vp", "outdated", "testnpm2", "-g", "--format", "list"], comment = "should render the newer latest as a hint in list format", continue-on-failure = true },
{ tty = false, argv = ["vp", "update", "-g"], comment = "should not move a pinned package to latest", continue-on-failure = true },
{ argv = ["vpt", "json-edit", "$VP_HOME/packages/testnpm2.json", "versionSpec", "no-such-tag"], comment = "should warn and skip when the recorded version spec no longer resolves", snapshot = false },
{ tty = false, argv = ["vp", "update", "-g"], continue-on-failure = true },
{ argv = ["vpt", "json-edit", "$VP_HOME/packages/testnpm2.json", "versionSpec", "null"], comment = "should follow latest again once the recorded version spec is cleared", snapshot = false },
{ argv = ["vp", "outdated", "testnpm2", "-g", "--format", "json"], comment = "should support global json output", continue-on-failure = true },
{ argv = ["vp", "outdated", "testnpm2", "-g", "--format", "list", "--concurrency", "5"], comment = "should support global list output", continue-on-failure = true },
{ argv = ["vpt", "json-edit", "$VP_HOME/packages/testnpm2.json", "versionSpec", "1.0.0"], comment = "should override a recorded version spec with --latest", snapshot = false },
{ tty = false, argv = ["vp", "update", "-g", "--latest"], continue-on-failure = true },
{ argv = ["vpt", "grep-file", "$VP_HOME/packages/testnpm2.json", "versionSpec"], comment = "should clear the recorded version spec after --latest (grep-file prints missing)", continue-on-failure = true },
{ argv = ["vpt", "json-edit", "$VP_HOME/packages/testnpm2.json", "versionSpec", "1.0.1"], comment = "should clear a recorded version spec with --latest even without a reinstall", snapshot = false },
{ tty = false, argv = ["vp", "update", "-g", "--latest"], continue-on-failure = true },
{ argv = ["vpt", "grep-file", "$VP_HOME/packages/testnpm2.json", "versionSpec"], comment = "should have removed the pin from the up-to-date package (grep-file prints missing)", continue-on-failure = true },
{ argv = ["vpt", "json-edit", "$VP_HOME/packages/testnpm2.json", "versionSpec", "1.0.0"], comment = "should persist an explicit spec switch without a reinstall", snapshot = false },
{ tty = false, argv = ["vp", "update", "-g", "testnpm2@1.0.1"], continue-on-failure = true },
{ argv = ["vpt", "grep-file", "$VP_HOME/packages/testnpm2.json", 'versionSpec": "1.0.1'], continue-on-failure = true },
{ tty = false, argv = ["vp", "update", "-g", "testnpm2@no-such-tag"], comment = "should not persist an explicit spec that fails to resolve", continue-on-failure = true },
{ argv = ["vpt", "grep-file", "$VP_HOME/packages/testnpm2.json", 'versionSpec": "1.0.1'], continue-on-failure = true },
]
after = [
{ argv = ["vp", "remove", "-g", "testnpm2"], continue-on-failure = true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## `vp install -g testnpm2@1.0.0`

should prepare global outdated package
should prepare a version-pinned global package


## `vp outdated definitely-not-installed-vite-plus-snap-pkg -g --format json`
Expand All @@ -13,6 +13,62 @@ should support empty global json output
{}
```

## `vp outdated testnpm2 -g --format json`

should report a pinned package without a wanted update

**Exit code:** 1

```
{
"testnpm2": {
"current": "1.0.0",
"wanted": "1.0.0",
"latest": "1.0.1",
"dependent": "global",
"location": "<home>/.vite-plus/packages/testnpm2#<uuid>/lib/node_modules/testnpm2"
}
}
```

## `vp outdated testnpm2 -g --format list`

should render the newer latest as a hint in list format

**Exit code:** 1

```
testnpm2 (global)
1.0.0 => 1.0.0 (latest: 1.0.1)
```

## `vp update -g`

should not move a pinned package to latest

```
All global packages are up to date.
```

## `vpt json-edit $VP_HOME/packages/testnpm2.json versionSpec no-such-tag`

should warn and skip when the recorded version spec no longer resolves


## `vp update -g`

**Exit code:** 1

```
All global packages are up to date.
warn: npm view failed for testnpm2@no-such-tag: npm error code E404; skipping
```

## `vpt json-edit $VP_HOME/packages/testnpm2.json versionSpec null`

should follow latest again once the recorded version spec is cleared


## `vp outdated testnpm2 -g --format json`

should support global json output
Expand Down Expand Up @@ -41,3 +97,82 @@ should support global list output
testnpm2 (global)
1.0.0 => 1.0.1
```

## `vpt json-edit $VP_HOME/packages/testnpm2.json versionSpec 1.0.0`

should override a recorded version spec with --latest


## `vp update -g --latest`

```
info: Updating 1 global package with Node.js <version>
✓ Updated testnpm2 to 1.0.1
```

## `vpt grep-file $VP_HOME/packages/testnpm2.json versionSpec`

should clear the recorded version spec after --latest (grep-file prints missing)

**Exit code:** 1

```
<home>/.vite-plus/packages/testnpm2.json: missing "versionSpec"
pattern not found
```

## `vpt json-edit $VP_HOME/packages/testnpm2.json versionSpec 1.0.1`

should clear a recorded version spec with --latest even without a reinstall


## `vp update -g --latest`

```
All global packages are up to date.
```

## `vpt grep-file $VP_HOME/packages/testnpm2.json versionSpec`

should have removed the pin from the up-to-date package (grep-file prints missing)

**Exit code:** 1

```
<home>/.vite-plus/packages/testnpm2.json: missing "versionSpec"
pattern not found
```

## `vpt json-edit $VP_HOME/packages/testnpm2.json versionSpec 1.0.0`

should persist an explicit spec switch without a reinstall


## `vp update -g testnpm2@1.0.1`

```
All global packages are up to date.
```

## `vpt grep-file $VP_HOME/packages/testnpm2.json 'versionSpec": "1.0.1'`

```
<home>/.vite-plus/packages/testnpm2.json: found "versionSpec\": \"1.0.1"
```

## `vp update -g testnpm2@no-such-tag`

should not persist an explicit spec that fails to resolve

**Exit code:** 1

```
All global packages are up to date.
warn: npm view failed for testnpm2@no-such-tag: npm error code E404; skipping
```

## `vpt grep-file $VP_HOME/packages/testnpm2.json 'versionSpec": "1.0.1'`

```
<home>/.vite-plus/packages/testnpm2.json: found "versionSpec\": \"1.0.1"
```
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,19 @@ steps = [
after = [
{ tty = false, argv = ["vp", "remove", "-g", "testnpm2"], continue-on-failure = true },
]

[[case]]
name = "command_update_node_mismatch_install_failure"
vp = "global"
local-registry = true
skip-platforms = ["windows"]
steps = [
{ tty = false, argv = ["vp", "install", "-g", "--node", "20", "semver@7.7.2"], snapshot = false },
{ argv = ["vpt", "json-edit", "$VP_HOME/bins/semver.json", "package", "conflicting-package"], snapshot = false },
{ tty = false, argv = ["vp", "update", "-g", "semver@=7.7.2", "--reinstall-node-mismatch"], comment = "should keep the recorded spec when the reinstall fails", continue-on-failure = true },
{ argv = ["vpt", "grep-file", "$VP_HOME/packages/semver.json", 'versionSpec": "7.7.2'], comment = "should keep metadata from the successful install", continue-on-failure = true },
]
after = [
{ argv = ["vpt", "json-edit", "$VP_HOME/bins/semver.json", "package", "semver"], continue-on-failure = true },
{ tty = false, argv = ["vp", "remove", "-g", "semver"], continue-on-failure = true },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# command_update_node_mismatch_install_failure

## `vp install -g --node 20 semver@7.7.2`


## `vpt json-edit $VP_HOME/bins/semver.json package conflicting-package`


## `vp update -g semver@=7.7.2 --reinstall-node-mismatch`

should keep the recorded spec when the reinstall fails

**Exit code:** 1

```
info: Updating 1 global package with Node.js <version>
error: Failed to update semver: Executable 'semver' is already installed by conflicting-package

Please remove conflicting-package before installing semver, or use --force to auto-replace
```

## `vpt grep-file $VP_HOME/packages/semver.json 'versionSpec": "7.7.2'`

should keep metadata from the successful install

```
<home>/.vite-plus/packages/semver.json: found "versionSpec\": \"7.7.2"
```
Loading
Loading