Skip to content

Commit 1f64b41

Browse files
byCedricmarionebl
authored andcommitted
refactor(cli): throw exception for invalid reports
1 parent 8862788 commit 1f64b41

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

@commitlint/cli/src/cli.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,17 @@ async function main(options) {
166166
}
167167
);
168168

169+
const output = format(report, flags);
170+
169171
if (!flags.quiet) {
170-
process.stdout.write(format(report, flags));
172+
process.stdout.write(output);
171173
}
172174

173-
process.exit(report.errorCount === 0 ? 0 : 1);
175+
if (!report.valid) {
176+
const err = new Error(output);
177+
err.type = pkg.name;
178+
throw err;
179+
}
174180
}
175181

176182
function checkFromStdin(input, flags) {

0 commit comments

Comments
 (0)