Skip to content

Commit 1efa57c

Browse files
committed
Port analyze exit-status tests to jest
1 parent fe74b8d commit 1efa57c

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

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
});
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
(package "" "" "")
2+
(scrog "unrecognized")
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; -*- mode: eask; lexical-binding: t -*-
2+
(package "check-dsl" "0.0.1" "Test for DSL")
3+
(keywords "dsl")

test/jest/analyze/errors/Eask-warn

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
(package "check-dsl" "0.0.1" "Test for DSL")
2+
3+
(keywords "dsl")
4+
5+
(package-file "none.el")

0 commit comments

Comments
 (0)