Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = (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 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