mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-04-24 22:09:54 -05:00
chore: return with an exit code of 1 on supplying an unknown command (#6079)
This commit is contained in:
@@ -3,9 +3,12 @@ const execa = require('execa')
|
||||
|
||||
const CLI_PATH = path.resolve(__dirname, '..', 'bin', 'vue.js')
|
||||
|
||||
const runAsync = async args => await execa(CLI_PATH, args)
|
||||
const runAsync = (args, options) => execa(CLI_PATH, args, options)
|
||||
|
||||
test('suggests matching command', async () => {
|
||||
const { stdout } = await runAsync(['confgi'])
|
||||
const { code, stdout } = await runAsync(['confgi'], { reject: false })
|
||||
|
||||
// Assertions
|
||||
expect(code).toBe(1)
|
||||
expect(stdout).toContain('Did you mean config?')
|
||||
})
|
||||
|
||||
@@ -213,6 +213,7 @@ program
|
||||
console.log(` ` + chalk.red(`Unknown command ${chalk.yellow(cmd)}.`))
|
||||
console.log()
|
||||
suggestCommands(cmd)
|
||||
process.exitCode = 1
|
||||
})
|
||||
|
||||
// add some useful info on help
|
||||
|
||||
Reference in New Issue
Block a user