Skip to content

Commit

Permalink
chore: return with an exit code of 1 on supplying an unknown command
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorge007 committed Nov 24, 2020
1 parent 746540b commit 86e29e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/@vue/cli/__tests__/args.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = async (args, options) => await 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 change: 1 addition & 0 deletions packages/@vue/cli/bin/vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ program
console.log(` ` + chalk.red(`Unknown command ${chalk.yellow(cmd)}.`))
console.log()
suggestCommands(cmd)
process.exitCode = 1
})

// add some useful info on help
Expand Down

0 comments on commit 86e29e1

Please sign in to comment.