Skip to content

Commit 39f4059

Browse files
committed
--strict flag exits with code 1
1 parent d6aa49c commit 39f4059

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lisp/core/analyze.el

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
;; JSON format
2929
(defvar eask-analyze--warnings nil)
3030
(defvar eask-analyze--errors nil)
31+
32+
;; Warning flag
33+
(defvar eask-analyze--warning-p nil)
3134
;; Error flag
3235
(defvar eask-analyze--error-p nil)
3336

@@ -92,6 +95,8 @@ Argument LEVEL and MSG are data from the debug log signal."
9295
(unless (string= " *temp*" (buffer-name)) ; avoid error from `package-file' directive
9396
(when (eq 'error level)
9497
(setq eask-analyze--error-p t))
98+
(when (eq 'warn level)
99+
(setq eask-analyze--warning-p t))
95100
(with-current-buffer (or (eask-analyze--load-buffer) (buffer-name))
96101
(funcall
97102
(cond ((eask-json-p) #'eask-analyze--write-json-format)
@@ -156,7 +161,9 @@ Argument LEVEL and MSG are data from the debug log signal."
156161
;; Files found, do the action!
157162
(files
158163
(eask-analyze--file files)
159-
(when eask-analyze--error-p
164+
(when (or eask-analyze--error-p
165+
;; strict flag turns warnings into errors
166+
(and eask-analyze--warning-p (eask-strict-p)))
160167
(eask--exit 'failure)))
161168
;; Pattern defined, but no file found!
162169
(patterns

test/jest/analyze.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ describe("analyze", () => {
130130
});
131131

132132
// --strict and --allow-error
133-
it.failing("should error when using --strict on Eask-warn", async () => {
133+
it("should error when using --strict on Eask-warn", async () => {
134134
await expect(ctx.runEask("analyze --strict Eask-warn")).rejects.toThrow();
135135
});
136136

0 commit comments

Comments
 (0)