Skip to content

Commit 79e70ac

Browse files
committed
fix: gte 100 exiting with 1
closes #122
1 parent c61dac9 commit 79e70ac

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

bin/cmd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let min = 0;
1919
if (gte) {
2020
const [, value] = gte.split("=");
2121
min = !isNaN(parseInt(value)) ? parseFloat(value) : 0;
22-
process.exitCode = result > min ? 0 : 1;
22+
process.exitCode = result >= min ? 0 : 1;
2323
returnVal = "";
2424
}
2525

tests/main.spec.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import total from "../src/index.js";
1+
// eslint-disable-next-line node/no-missing-import
22
import test from "ava";
3+
import { exec as ex } from "child_process";
4+
import total from "../src/index.js";
35
import util from "util";
4-
import { exec as ex } from "node:child_process";
56

67
const exec = util.promisify(ex);
78

@@ -33,6 +34,12 @@ test("Should exit(0) if greater than equal then 90", async (t) => {
3334
t.is(stderr, "");
3435
});
3536

37+
test("Should exit(1) if checking for --gte=100", async (t) => {
38+
await t.throwsAsync(
39+
exec("node ./bin/cmd.js ./tests/fixtures/lcov.info --gte=100")
40+
);
41+
});
42+
3643
test("Should error on file missing", async (t) => {
3744
await t.throwsAsync(() => exec("node ./bin/cmd.js"));
3845
});

0 commit comments

Comments
 (0)