Skip to content

Commit 1248e72

Browse files
committed
fix(maven): propagate batch runner exit code failures
The batch executor was always resolving the promise even when the batch runner JAR exited with a non-zero code. This meant that test failures were not being propagated back to the CLI. Now properly rejects the promise when exitCode !== 0, ensuring that: - Failed tests cause the nx command to throw an error - The test output is captured and displayed - The overall command exits with the correct exit code
1 parent 2b4bf9c commit 1248e72

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/maven/src/executors/maven/maven-batch.impl.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,12 @@ export default async function* mavenBatchExecutor(
197197
console.error(output);
198198
}
199199
}
200-
resolve();
200+
// Reject promise if batch runner exited with non-zero code
201+
if (code !== 0) {
202+
reject(new Error(`Maven batch runner exited with code ${code}`));
203+
} else {
204+
resolve();
205+
}
201206
});
202207
child.on('error', reject);
203208
});

0 commit comments

Comments
 (0)