Skip to content

Commit 9070487

Browse files
chore: return with an exit code of 1 on supplying an unknown command
1 parent e10545a commit 9070487

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const path = require('path')
2+
const execa = require('execa')
3+
4+
const CLI_PATH = path.resolve(__dirname, '..', '..', 'bin', 'vue.js')
5+
6+
const runAsync = async (args, options) => execa(CLI_PATH, args, options)
7+
8+
test('suggests matching command', async () => {
9+
const { code, stdout } = await runAsync(['confgi'], { reject: false })
10+
11+
// Assertions
12+
expect(code).toBe(1)
13+
expect(stdout).toContain('Did you mean config?')
14+
})

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

Lines changed: 0 additions & 11 deletions
This file was deleted.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ program
224224
console.log(` ` + chalk.red(`Unknown command ${chalk.yellow(cmd)}.`))
225225
console.log()
226226
suggestCommands(cmd)
227+
process.exitCode = 1
227228
})
228229

229230
// add some useful info on help

packages/@vue/cli/lib/Creator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ module.exports = class Creator extends EventEmitter {
160160

161161
if (!version) {
162162
if (isOfficialPlugin(dep) || dep === '@vue/cli-service' || dep === '@vue/babel-preset-env') {
163-
version = `~${latestMinor}`
163+
version = isTestOrDebug ? `latest` : `~${latestMinor}`
164164
} else {
165165
version = 'latest'
166166
}

0 commit comments

Comments
 (0)