From 9814124e98cfe953f700ec4bc3201cb693d8f91c Mon Sep 17 00:00:00 2001 From: Vladimir Date: Fri, 25 Nov 2022 09:43:47 +0100 Subject: [PATCH] fix: exit with code 1, when type tests fail (#2378) --- 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)