Skip to content

Commit da8bd39

Browse files
chore: return with an exit code of 1 on supplying an unknown command (#6079)
1 parent 928f915 commit da8bd39

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ const execa = require('execa')
33

44
const CLI_PATH = path.resolve(__dirname, '..', 'bin', 'vue.js')
55

6-
const runAsync = async args => await execa(CLI_PATH, args)
6+
const runAsync = (args, options) => execa(CLI_PATH, args, options)
77

88
test('suggests matching command', async () => {
9-
const { stdout } = await runAsync(['confgi'])
9+
const { code, stdout } = await runAsync(['confgi'], { reject: false })
10+
11+
// Assertions
12+
expect(code).toBe(1)
1013
expect(stdout).toContain('Did you mean config?')
1114
})

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ program
213213
console.log(` ` + chalk.red(`Unknown command ${chalk.yellow(cmd)}.`))
214214
console.log()
215215
suggestCommands(cmd)
216+
process.exitCode = 1
216217
})
217218

218219
// add some useful info on help

0 commit comments

Comments
 (0)