diff --git a/lib/core/reporters/v1.js b/lib/core/reporters/v1.js index cd2d727ee0..ac1c137617 100644 --- a/lib/core/reporters/v1.js +++ b/lib/core/reporters/v1.js @@ -9,11 +9,14 @@ axe.addReporter('v1', function(results, options, callback) { } var out = helpers.processAggregate(results, options); - out.violations.forEach(result => + const addFailureSummaries = result => { result.nodes.forEach(nodeResult => { nodeResult.failureSummary = helpers.failureSummary(nodeResult); - }) - ); + }); + }; + + out.incomplete.forEach(addFailureSummaries); + out.violations.forEach(addFailureSummaries); callback({ ...helpers.getEnvironmentData(), diff --git a/test/core/reporters/v1.js b/test/core/reporters/v1.js index 93c9b9836a..8131df8132 100644 --- a/test/core/reporters/v1.js +++ b/test/core/reporters/v1.js @@ -84,6 +84,34 @@ describe('reporters - v1', function() { } ] }, + { + id: 'incomplete', + description: 'something yet more nifty', + tags: ['tag4'], + impact: 'monkeys', + result: 'failed', + passes: [], + violations: [], + incomplete: [ + { + result: 'failed', + impact: 'monkeys', + none: [ + { + data: 'foon', + impact: 'monkeys', + result: true + } + ], + any: [], + all: [], + node: { + selector: ['foon'], + source: 'telephone' + } + } + ] + }, { id: 'blinky', description: 'something awesome', @@ -232,8 +260,11 @@ describe('reporters - v1', function() { }); it('should add the failure summary to the node data', function(done) { var origFn = window.helpers.failureSummary; - window.helpers.failureSummary = function() { - return 'your foon is ringing'; + window.helpers.failureSummary = function(nodeData) { + if (!nodeData || !nodeData.target) { + return; + } + return 'selector: ' + nodeData.target; }; axe.run(optionsV1, function(err, results) { assert.isNull(err); @@ -241,7 +272,11 @@ describe('reporters - v1', function() { assert.equal(results.violations[0].nodes.length, 1); assert.equal( results.violations[0].nodes[0].failureSummary, - 'your foon is ringing' + 'selector: q,r,pillock' + ); + assert.equal( + results.incomplete[0].nodes[0].failureSummary, + 'selector: foon' ); window.helpers.failureSummary = origFn; done();