Skip to content

Commit 09522aa

Browse files
committed
Emit null instead of empty object for validateAshHooks
This was left to minimize report.json changes in earlier refactoring. Fixing it now should only affect the report.json structure but not report.html.
1 parent 3f0959f commit 09522aa

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

lib/validator.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,13 @@ const ashnazgHookUrls = [
186186
];
187187

188188
function validateAshHooks(hooks) {
189-
// Note: unlike `reportError` used above, here empty object literals are
190-
// pushed instead of nulls. This is simply to match the original structure
191-
// of report.json. TODO: change this to null, or add error details.
192189
const errors = [];
193190
const ashHooks = hooks.filter(h => ashnazgHookUrls.includes(h.config.url) && h.config.contentType === "json" && h.config.insecureSsl === "0" && h.config.secret !== "");
194191
if (ashHooks.length === 0) {
195-
errors.push(['missingashnazghook', {}]);
192+
errors.push(['missingashnazghook', null]);
196193
}
197194
if (ashHooks.length > 1) {
198-
errors.push(['duplicateashnazghooks', {}]);
195+
errors.push(['duplicateashnazghooks', null]);
199196
}
200197
return errors;
201198
}

test/validator.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ describe('validateAshHooks', () => {
411411
it('no hooks', () => {
412412
const hooks = [];
413413
const errors = validateAshHooks(hooks);
414-
assert.deepStrictEqual(errors, [['missingashnazghook', {}]]);
414+
assert.deepStrictEqual(errors, [['missingashnazghook', null]]);
415415
});
416416

417417
it('one hook', () => {
@@ -444,6 +444,6 @@ describe('validateAshHooks', () => {
444444
}
445445
}];
446446
const errors = validateAshHooks(hooks);
447-
assert.deepStrictEqual(errors, [['duplicateashnazghooks', {}]]);
447+
assert.deepStrictEqual(errors, [['duplicateashnazghooks', null]]);
448448
});
449449
});

0 commit comments

Comments
 (0)