Skip to content

Commit 0935653

Browse files
test: add case for unknown command
1 parent 959741d commit 0935653

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

e2e/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,8 @@ test('shows help with -h flag', matchSnapshot, '-h')
2020
test('shows help with --help flag', matchSnapshot, '--help')
2121
test('shows version information with -v flag', matchSnapshot, '-v')
2222
test('shows version information with --version flag', matchSnapshot, '--version')
23+
24+
test('rejects promise due to error on passing in an unknown command', async t => {
25+
const {stderr} = await execa(rootCommand, ['junkcmd'], {reject: false})
26+
t.snapshot(stderr)
27+
})

e2e/index.js.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,27 @@ Generated by [AVA](https://ava.li).
8989
docsify-cli version:␊
9090
4.4.0␊
9191
`
92+
93+
## rejects promise due to error on passing in an unknown command
94+
95+
> Snapshot 1
96+
97+
`Usage: docsify <init|serve> <path>␊
98+
99+
Commands:␊
100+
docsify init [path] Creates new docs␊
101+
docsify serve [path] Run local server to preview site.␊
102+
docsify start <path> Server for SSR␊
103+
104+
Global Options␊
105+
--help, -h Show help [boolean]␊
106+
--version, -v Show version number [boolean]␊
107+
108+
Documentation:␊
109+
https://docsifyjs.github.io/docsify␊
110+
https://docsifyjs.github.io/docsify-cli␊
111+
112+
Development:␊
113+
https://github.com/docsifyjs/docsify-cli/blob/master/CONTRIBUTING.md␊
114+
115+
Unknown argument: junkcmd`

e2e/index.js.snap

52 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)