Skip to content

Commit 256a094

Browse files
committed
test: use Node.js script for cross-platform args passthrough test
Replace echo-based scripts with a Node.js args printer to ensure consistent output across Unix and Windows. Restores the args passthrough test case that was removed due to pnpm quoting differences.
1 parent 79168cf commit 256a094

4 files changed

Lines changed: 20 additions & 4 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Print arguments passed to this script, one per line
2+
for (const arg of process.argv.slice(2)) {
3+
console.log(arg);
4+
}

packages/cli/snap-tests-global/command-vpr/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "command-vpr",
33
"version": "1.0.0",
44
"scripts": {
5-
"hello": "echo hello from script",
6-
"greet": "echo greet"
5+
"hello": "node args.mjs hello from script",
6+
"greet": "node args.mjs greet"
77
},
88
"packageManager": "pnpm@10.19.0"
99
}

packages/cli/snap-tests-global/command-vpr/snap.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,20 @@ Documentation: https://viteplus.dev/guide/run
3434
> vpr hello # should run script via vpr shorthand
3535

3636
> command-vpr@<semver> hello <cwd>
37-
> echo hello from script
37+
> node args.mjs hello from script
3838

39-
hello from script
39+
hello
40+
from
41+
script
42+
43+
> vpr greet --arg1 value1 # should pass through additional args
44+
45+
> command-vpr@<semver> greet <cwd>
46+
> node args.mjs greet --arg1 value1
47+
48+
greet
49+
--arg1
50+
value1
4051

4152
[1]> vpr nonexistent # should show pnpm missing script error
4253
 ERR_PNPM_NO_SCRIPT  Missing script: nonexistent

packages/cli/snap-tests-global/command-vpr/steps.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"commands": [
33
"vpr -h # should show vp run help",
44
"vpr hello # should run script via vpr shorthand",
5+
"vpr greet --arg1 value1 # should pass through additional args",
56
"vpr nonexistent # should show pnpm missing script error"
67
]
78
}

0 commit comments

Comments
 (0)