Skip to content

Commit

Permalink
fix(vite): exit from test if no files found
Browse files Browse the repository at this point in the history
  • Loading branch information
AliYusuf95 authored Aug 31, 2024
1 parent 18e5535 commit 0db494d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/vite/src/executors/test/vitest.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,15 @@ export async function* vitestExecutor(
process.on('exit', processExit);
}

for await (const report of nxReporter) {
// vitest sets the exitCode = 1 when code coverage isn't met
hasErrors =
report.hasErrors || (process.exitCode && process.exitCode !== 0);
// vitest sets the exitCode in case of exception without notifying reporters
if (process.exitCode === undefined) {
for await (const report of nxReporter) {
// vitest sets the exitCode = 1 when code coverage isn't met
hasErrors =
report.hasErrors || (process.exitCode && process.exitCode !== 0);
}
} else {
hasErrors = process.exitCode !== 0
}

return {
Expand Down

0 comments on commit 0db494d

Please sign in to comment.