From d69c9ade20b5a1e3c57071fad14ba0157dd8753e Mon Sep 17 00:00:00 2001 From: Vladimir Sheremet Date: Thu, 24 Nov 2022 13:34:11 +0100 Subject: [PATCH] fix: exit with code 1, when type tests fail --- packages/vitest/src/node/core.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/vitest/src/node/core.ts b/packages/vitest/src/node/core.ts index cb57de591df9..2cd058f64cb2 100644 --- a/packages/vitest/src/node/core.ts +++ b/packages/vitest/src/node/core.ts @@ -160,10 +160,14 @@ export class Vitest { checker.onParseEnd(async ({ files, sourceErrors }) => { this.state.collectFiles(checker.getTestFiles()) await this.report('onCollected') - if (!files.length) + if (!files.length) { this.logger.printNoTestFound() - else + } + else { + if (hasFailed(files)) + process.exitCode = 1 await this.report('onFinished', files) + } if (sourceErrors.length && !this.config.typecheck.ignoreSourceErrors) { process.exitCode = 1 await this.logger.printSourceTypeErrors(sourceErrors)