From 82b52ff9e4f46494cd57d184a9e5982c90eae659 Mon Sep 17 00:00:00 2001 From: Steve 11905 Date: Mon, 21 Sep 2020 09:35:19 +0100 Subject: [PATCH] Added support for a custom message on output --- src/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 0135c01..eefbb88 100644 --- a/src/index.js +++ b/src/index.js @@ -18,12 +18,14 @@ const checkA11y = ( context, options, violationCallback, - skipFailures = false + skipFailures = false, + message ) => { cy.window({ log: false }) .then(win => { if (isEmptyObjectorNull(context)) context = undefined if (isEmptyObjectorNull(options)) options = undefined + if (isEmptyObjectorNull(message)) message = context === undefined ? '' : context if (isEmptyObjectorNull(violationCallback)) violationCallback = undefined const { includedImpacts, ...axeOptions } = options || {} return win.axe @@ -39,7 +41,7 @@ const checkA11y = ( .then(violations => { if (violations.length) { if (violationCallback) { - violationCallback(violations) + violationCallback(violations, message) } cy.wrap(violations, { log: false }).each(v => { const selectors = v.nodes