From 3e807f0e9b55d1278157cd3ee211ce6d1790b80b Mon Sep 17 00:00:00 2001 From: Steven Lambert Date: Mon, 10 Jun 2019 14:45:07 -0600 Subject: [PATCH] fix: deprecate na reporter (#1625) * fix: deprecate na reporter * properly restore console --- lib/core/reporters/na.js | 4 ++++ test/core/log.js | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/core/reporters/na.js b/lib/core/reporters/na.js index 29e8c5ae1e..407b0cc85b 100644 --- a/lib/core/reporters/na.js +++ b/lib/core/reporters/na.js @@ -3,6 +3,10 @@ axe.addReporter('na', function(results, options, callback) { 'use strict'; + console.warn( + '"na" reporter will be deprecated in axe v4.0. Use the "v2" reporter instead.' + ); + if (typeof options === 'function') { callback = options; options = {}; diff --git a/test/core/log.js b/test/core/log.js index d5419dbe84..1ab12eb04e 100644 --- a/test/core/log.js +++ b/test/core/log.js @@ -5,10 +5,10 @@ describe('axe.log', function() { assert.isFunction(axe.log); }); it('should invoke console.log', function() { + var orig = window.console; if (!window.console || window.console.log) { window.console = { log: function() {} }; } - var orig = window.console.log; var expected = ['hi', 'hello']; var success = false; @@ -21,6 +21,6 @@ describe('axe.log', function() { axe.log.apply(axe.log, expected); assert.isTrue(success); - window.console.log = orig; + window.console = orig; }); });