Skip to content

Commit f0cd37b

Browse files
committed
fix: add missing serve command to demo.cac.ts to correct CLI test snapshots
1 parent 6660bc9 commit f0cd37b

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

examples/demo.cac.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ cli
1414
.option('-p, --port <port>', `Specify port`)
1515
.action((options) => {});
1616

17+
cli
18+
.command('serve', 'Start the server')
19+
.option('-H, --host [host]', `Specify hostname`)
20+
.option('-p, --port <port>', `Specify port`)
21+
.action((options) => {});
22+
1723
cli.command('dev build', 'Build project').action((options) => {});
1824

1925
cli.command('lint [...files]', 'Lint project').action((files, options) => {});

tests/__snapshots__/cli.test.ts.snap

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

33
exports[`cli completion tests for cac > cli option completion tests > should complete option for partial input '{ partial: '--p', expected: '--port' }' 1`] = `
4-
":4
4+
"--port Specify port
5+
:4
56
"
67
`;
78

@@ -38,22 +39,28 @@ vite.config.js Vite config file
3839
`;
3940

4041
exports[`cli completion tests for cac > cli option value handling > should resolve port value correctly 1`] = `
41-
":4
42+
"--port=3000 Development server port
43+
:4
4244
"
4345
`;
4446

4547
exports[`cli completion tests for cac > edge case completions for end with space > should keep suggesting the --port option if user typed partial but didn't end with space 1`] = `
46-
":4
48+
"--port Specify port
49+
:4
4750
"
4851
`;
4952

5053
exports[`cli completion tests for cac > edge case completions for end with space > should suggest port values if user ends with space after \`--port\` 1`] = `
51-
":4
54+
"3000 Development server port
55+
8080 Alternative port
56+
:4
5257
"
5358
`;
5459

5560
exports[`cli completion tests for cac > edge case completions for end with space > should suggest port values if user typed \`--port=\` and hasn't typed a space or value yet 1`] = `
56-
":4
61+
"--port=3000 Development server port
62+
--port=8080 Alternative port
63+
:4
5764
"
5865
`;
5966

@@ -102,6 +109,7 @@ exports[`cli completion tests for cac > short flag handling > should not show du
102109

103110
exports[`cli completion tests for cac > should complete cli options 1`] = `
104111
"dev Start dev server
112+
serve Start the server
105113
lint Lint project
106114
:4
107115
"

0 commit comments

Comments
 (0)