chore: return with an exit code of 1 on supplying an unknown command (#6079)

This commit is contained in:
James George
2020-12-02 07:48:40 +05:30
committed by GitHub
parent 928f915406
commit da8bd3970b
2 changed files with 6 additions and 2 deletions
+5 -2
View File
@@ -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?')
})
+1
View File
@@ -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