Skip to content

Commit 98d330b

Browse files
committed
test: check if check task exits when solhint violations are discovered
1 parent 1855d13 commit 98d330b

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

packages/hardhat-solhint/test/tests.ts

+18-1
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,28 @@ describe("Solhint plugin", function () {
3636
);
3737
});
3838

39-
it("should run the check task without throwing an error", async function () {
39+
it("should run the check task and exit", async function () {
4040
const consoleLogStub = sinon.stub(console, "log");
41+
const processExitStub = sinon.stub(process, "exit");
4142
await this.env.run("check");
4243
assert.isTrue(consoleLogStub.calledOnce);
44+
assert.isTrue(processExitStub.calledOnceWith(1));
4345
consoleLogStub.restore();
46+
processExitStub.restore();
47+
});
48+
});
49+
50+
describe("Project with no errors", function () {
51+
useEnvironment("no-errors-project");
52+
53+
it("should run the check task and not exit", async function () {
54+
const consoleLogStub = sinon.stub(console, "log");
55+
const processExitStub = sinon.stub(process, "exit");
56+
await this.env.run("check");
57+
assert.isTrue(consoleLogStub.calledOnce);
58+
assert.isTrue(processExitStub.notCalled);
59+
consoleLogStub.restore();
60+
processExitStub.restore();
4461
});
4562
});
4663

0 commit comments

Comments
 (0)