File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -114,15 +114,15 @@ Argument LEVEL and MSG are data from the debug log signal."
114114
115115 ; ; Print result
116116 (eask-msg " " )
117- (cond ((and ( eask-json-p) ; JSON format
118- (or eask-analyze--warnings eask-analyze--errors) )
119- (setq content
120- (eask-analyze--pretty-json (json-encode
121- `((warnings . , eask-analyze--warnings )
122- (errors . , eask-analyze--errors )))))
117+ (cond ((eask-json-p) ; JSON format
118+ ( when (or eask-analyze--warnings eask-analyze--errors)
119+ (setq content
120+ (eask-analyze--pretty-json (json-encode
121+ `((warnings . , eask-analyze--warnings )
122+ (errors . , eask-analyze--errors) )))))
123123 ; ; XXX: When printing the result, no color allow.
124124 (eask--with-no-color
125- (eask-stdout content)))
125+ (eask-stdout ( or content " {} " ) )))
126126 (eask-analyze--log ; Plain text
127127 (setq content
128128 (with-temp-buffer
Original file line number Diff line number Diff line change @@ -2,12 +2,13 @@ const { TestContext } = require("./helpers");
22
33/**
44 * Clean output and attempt to parse as JSON.
5+ * Does not accept empty strings as JSON.
56 * Throws if failing.
67 * @param {string } s
78 * @returns {object } the parsed JSON.
89 */
910function tryJSON ( s ) {
10- return JSON . parse ( s . trim ( ) || "{}" ) ;
11+ return JSON . parse ( s . trim ( ) ) ;
1112}
1213
1314describe ( "analyze" , ( ) => {
You can’t perform that action at this time.
0 commit comments