Skip to content

Commit 00720a4

Browse files
committed
test(cli): add snap test for shell environment detection
1 parent cbad4a1 commit 00720a4

3 files changed

Lines changed: 62 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "command-env-use-shells",
3+
"version": "1.0.0",
4+
"private": true
5+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
> VP_SHELL=bash vp env use 20.18.0 --no-install # should detect bash and output posix export
2+
export VP_NODE_VERSION=20.18.0
3+
Using Node.js v<semver> (resolved from <semver>)
4+
5+
> VP_SHELL=zsh vp env use 20.18.0 --no-install # should detect zsh and output posix export
6+
export VP_NODE_VERSION=20.18.0
7+
Using Node.js v<semver> (resolved from <semver>)
8+
9+
> VP_SHELL=fish vp env use 20.18.0 --no-install # should detect fish and output fish export
10+
set -gx VP_NODE_VERSION <semver>
11+
Using Node.js v<semver> (resolved from <semver>)
12+
13+
> VP_SHELL=nu vp env use 20.18.0 --no-install # should detect nushell and output nushell export
14+
$env.VP_NODE_VERSION = "20.18.0"
15+
Using Node.js v<semver> (resolved from <semver>)
16+
17+
> VP_SHELL=pwsh vp env use 20.18.0 --no-install # should detect powershell and output powershell export
18+
$env:VP_NODE_VERSION = "20.18.0"
19+
Using Node.js v<semver> (resolved from <semver>)
20+
21+
> VP_SHELL=cmd vp env use 20.18.0 --no-install # should detect cmd and output cmd export
22+
set VP_NODE_VERSION=20.18.0
23+
Using Node.js v<semver> (resolved from <semver>)
24+
25+
> VP_SHELL=BASH vp env use 20.18.0 --no-install # should detect case-insensitive bash
26+
export VP_NODE_VERSION=20.18.0
27+
Using Node.js v<semver> (resolved from <semver>)
28+
29+
> VP_SHELL=FISH vp env use 20.18.0 --no-install # should detect case-insensitive fish
30+
set -gx VP_NODE_VERSION <semver>
31+
Using Node.js v<semver> (resolved from <semver>)
32+
33+
> VP_SHELL=POWERSHELL vp env use 20.18.0 --no-install # should detect case-insensitive powershell
34+
$env:VP_NODE_VERSION = "20.18.0"
35+
Using Node.js v<semver> (resolved from <semver>)
36+
37+
> VP_SHELL=invalid vp env use 20.18.0 --no-install # should fallback to platform default
38+
export VP_NODE_VERSION=20.18.0
39+
Using Node.js v<semver> (resolved from <semver>)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"env": {
3+
"VP_ENV_USE_EVAL_ENABLE": "1"
4+
},
5+
"ignoredPlatforms": ["win32"],
6+
"commands": [
7+
"VP_SHELL=bash vp env use 20.18.0 --no-install # should detect bash and output posix export",
8+
"VP_SHELL=zsh vp env use 20.18.0 --no-install # should detect zsh and output posix export",
9+
"VP_SHELL=fish vp env use 20.18.0 --no-install # should detect fish and output fish export",
10+
"VP_SHELL=nu vp env use 20.18.0 --no-install # should detect nushell and output nushell export",
11+
"VP_SHELL=pwsh vp env use 20.18.0 --no-install # should detect powershell and output powershell export",
12+
"VP_SHELL=cmd vp env use 20.18.0 --no-install # should detect cmd and output cmd export",
13+
"VP_SHELL=BASH vp env use 20.18.0 --no-install # should detect case-insensitive bash",
14+
"VP_SHELL=FISH vp env use 20.18.0 --no-install # should detect case-insensitive fish",
15+
"VP_SHELL=POWERSHELL vp env use 20.18.0 --no-install # should detect case-insensitive powershell",
16+
"VP_SHELL=invalid vp env use 20.18.0 --no-install # should fallback to platform default"
17+
]
18+
}

0 commit comments

Comments
 (0)