Skip to content

Commit 4445df5

Browse files
chore: return with an exit code of 1 on supplying an unknown command
1 parent 8230aa3 commit 4445df5

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const path = require('path')
2+
const execa = require('execa')
3+
4+
const CLI_PATH = path.resolve(__dirname, '..', '..', 'bin', 'vue.js')
5+
6+
const runAsync = async (args, options) => execa(CLI_PATH, args, options)
7+
8+
test('suggests matching command', async () => {
9+
const { code, stdout } = await runAsync(['confgi'], { reject: false })
10+
11+
// Assertions
12+
expect(code).toBe(1)
13+
expect(stdout).toContain('Did you mean config?')
14+
})

packages/@vue/cli/__tests__/args.spec.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/@vue/cli/bin/vue.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ program
224224
console.log(` ` + chalk.red(`Unknown command ${chalk.yellow(cmd)}.`))
225225
console.log()
226226
suggestCommands(cmd)
227+
process.exitCode = 1
227228
})
228229

229230
// add some useful info on help

0 commit comments

Comments
 (0)