Skip to content

Commit 1eddbb3

Browse files
committed
Port analyze exit-status tests to jest
1 parent c83402a commit 1eddbb3

File tree

6 files changed

+38
-51
lines changed

6 files changed

+38
-51
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ error:
2121
./test/error/run.sh
2222

2323
test-exit-status:
24-
./test/exit-status/analyze/run.sh
2524
./test/exit-status/clean/run.sh
2625
./test/exit-status/compile/run.sh
2726
./test/exit-status/create/run.sh

test/exit-status/analyze/run.sh

Lines changed: 0 additions & 50 deletions
This file was deleted.

test/jest/analyze.test.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,42 @@ describe("analyze", () => {
5151
await ctx.runEask("analyze Eask --json");
5252
});
5353
});
54+
55+
describe("in ./analyze/errors", () => {
56+
const ctx = new TestContext("./test/jest/analyze/errors");
57+
58+
// Eask-normal - no errors or warnings
59+
// Eask-warn - only warnings
60+
// Eask-error - errors and warnings
61+
62+
it("should check Eask-normal", async () => {
63+
await ctx.runEask("analyze Eask-normal");
64+
});
65+
66+
it("should check Eask-warn", async () => {
67+
await ctx.runEask("analyze Eask-warn");
68+
});
69+
70+
it.failing("should error on Eask-errors", async () => {
71+
await expect(ctx.runEask("analyze Eask-error")).rejects.toThrow();
72+
});
73+
74+
it.failing("should error when using --strict on Eask-warn", async () => {
75+
await expect(ctx.runEask("analyze --strict Eask-warn")).rejects.toThrow();
76+
});
77+
78+
// sanity check: flag should not change behavior in this case
79+
// this is because the menaing of --allow-error is "continue to the end"
80+
it.failing("should error when --allow-error is set", async () => {
81+
await expect(
82+
ctx.runEask("analyze Eask-error --allow-error"),
83+
).rejects.toThrow();
84+
});
85+
86+
it.failing("should check all files when --allow-error is set", async () => {
87+
await expect(
88+
ctx.runEask("analyze --allow-error Eask-normal Eask-error"),
89+
).rejects.toMatchObject({ stderr: "(Checked 2 files)" });
90+
});
91+
});
5492
});

0 commit comments

Comments
 (0)