From 87260de98aca3b6aa82790ba04a30da1678e163f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Thu, 19 Dec 2019 14:18:54 +0800 Subject: [PATCH] feat(cli): should exit process when test failed --- packages/vant-cli/src/commands/jest.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/vant-cli/src/commands/jest.ts b/packages/vant-cli/src/commands/jest.ts index dff1a312f..fea8de048 100644 --- a/packages/vant-cli/src/commands/jest.ts +++ b/packages/vant-cli/src/commands/jest.ts @@ -17,5 +17,17 @@ export function test(command: any) { clearCache: command.clearCache } as any; - runCLI(config, [ROOT]); + runCLI(config, [ROOT]) + .then(response => { + if (!response.results.success && !command.watch) { + process.exit(1); + } + }) + .catch(err => { + console.log(err); + + if (!command.watch) { + process.exit(1); + } + }); }