diff --git a/lib/core/base/audit.js b/lib/core/base/audit.js
index dbddcdb8f1..36bcb325ff 100644
--- a/lib/core/base/audit.js
+++ b/lib/core/base/audit.js
@@ -191,7 +191,7 @@ export default class Audit {
this.checks = {};
this.brand = 'axe';
this.application = 'axeAPI';
- this.tagExclude = ['experimental'];
+ this.tagExclude = ['experimental', 'deprecated'];
this.noHtml = audit.noHtml;
this.allowedOrigins = audit.allowedOrigins;
unpackToObject(audit.rules, this, 'addRule');
diff --git a/test/core/base/audit.js b/test/core/base/audit.js
index 7160c0db1c..b04002874d 100644
--- a/test/core/base/audit.js
+++ b/test/core/base/audit.js
@@ -439,12 +439,12 @@ describe('Audit', () => {
});
it('should reset brand tagExlcude', () => {
axe._load({});
- assert.deepEqual(axe._audit.tagExclude, ['experimental']);
+ assert.deepEqual(axe._audit.tagExclude, ['experimental', 'deprecated']);
axe.configure({
tagExclude: ['ninjas']
});
axe._audit.resetRulesAndChecks();
- assert.deepEqual(axe._audit.tagExclude, ['experimental']);
+ assert.deepEqual(axe._audit.tagExclude, ['experimental', 'deprecated']);
});
it('should reset noHtml', () => {
diff --git a/test/core/public/configure.js b/test/core/public/configure.js
index 12972a0aeb..219b0cc1f7 100644
--- a/test/core/public/configure.js
+++ b/test/core/public/configure.js
@@ -269,7 +269,7 @@ describe('axe.configure', function () {
it('overrides the default value of audit.tagExclude', function () {
axe._load({});
- assert.deepEqual(axe._audit.tagExclude, ['experimental']);
+ assert.deepEqual(axe._audit.tagExclude, ['experimental', 'deprecated']);
axe.configure({
tagExclude: ['ninjas']
diff --git a/test/integration/full/configuration/tag-exclude.html b/test/integration/full/configuration/tag-exclude.html
new file mode 100644
index 0000000000..62f4efbd49
--- /dev/null
+++ b/test/integration/full/configuration/tag-exclude.html
@@ -0,0 +1,31 @@
+
+
+
+ axe.configure({ tagExclude }) test
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/integration/full/configuration/tag-exclude.js b/test/integration/full/configuration/tag-exclude.js
new file mode 100644
index 0000000000..1f369f01ea
--- /dev/null
+++ b/test/integration/full/configuration/tag-exclude.js
@@ -0,0 +1,112 @@
+describe('all rules test', () => {
+ const experimentalRuleId = 'img-alt-experimental';
+ const deprecatedRuleId = 'img-alt-deprecated';
+
+ beforeEach(() => {
+ axe.configure({
+ rules: [
+ {
+ id: experimentalRuleId,
+ impact: 'critical',
+ selector: 'img',
+ tags: ['wcag2a', 'experimental'],
+ enabled: false,
+ metadata: {
+ description:
+ 'Ensures elements have alternate text or a role of none or presentation',
+ help: 'Images must have alternate text'
+ },
+ all: [],
+ any: ['has-alt'],
+ none: []
+ },
+ {
+ id: deprecatedRuleId,
+ impact: 'critical',
+ selector: 'img',
+ tags: ['wcag2a', 'deprecated'],
+ enabled: false,
+ metadata: {
+ description:
+ 'Ensures elements have alternate text or a role of none or presentation',
+ help: 'Images must have alternate text'
+ },
+ all: [],
+ any: ['has-alt'],
+ none: []
+ }
+ ]
+ });
+ });
+
+ after(() => {
+ axe.reset();
+ });
+
+ function findResult(results, ruleId) {
+ return [
+ ...results.violations,
+ ...results.passes,
+ ...results.incomplete,
+ ...results.inapplicable
+ ].find(result => result.id === ruleId);
+ }
+
+ it('does not run experimental rules by default', async () => {
+ const results = await axe.run({
+ runOnly: {
+ type: 'tags',
+ values: ['wcag2a']
+ }
+ });
+ assert.isUndefined(findResult(results, experimentalRuleId));
+ });
+
+ it('does not run deprecated rules by default', async () => {
+ const results = await axe.run({
+ runOnly: {
+ type: 'tags',
+ values: ['wcag2a']
+ }
+ });
+ assert.isUndefined(findResult(results, deprecatedRuleId));
+ });
+
+ it('runs tagExclude rules when enabled with { rules }', async () => {
+ const results = await axe.run({
+ runOnly: {
+ type: 'tags',
+ values: ['wcag2a']
+ },
+ rules: {
+ [experimentalRuleId]: { enabled: true },
+ [deprecatedRuleId]: { enabled: true }
+ }
+ });
+
+ assert.isDefined(findResult(results, experimentalRuleId));
+ assert.isDefined(findResult(results, deprecatedRuleId));
+ });
+
+ it('runs tagExclude rules when enabled with { runOnly: { type: rule } }', async () => {
+ const results = await axe.run({
+ runOnly: {
+ type: 'rule',
+ values: [experimentalRuleId, deprecatedRuleId]
+ }
+ });
+ assert.isDefined(findResult(results, experimentalRuleId));
+ assert.isDefined(findResult(results, deprecatedRuleId));
+ });
+
+ it('runs tagExclude rules when enabled with { runOnly: { type: tag } }', async () => {
+ const results = await axe.run({
+ runOnly: {
+ type: 'tag',
+ values: ['wcag2a', 'experimental', 'deprecated']
+ }
+ });
+ assert.isDefined(findResult(results, experimentalRuleId));
+ assert.isDefined(findResult(results, deprecatedRuleId));
+ });
+});