This repository was archived by the owner on Mar 19, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ class AxeInjector {
1717
1818 this . didLogError = true ;
1919 // eslint-disable-next-line no-console
20- console . log ( 'Failed to inject axe-core into one of the iframes!' ) ;
20+ console . error ( 'Failed to inject axe-core into one of the iframes!' ) ;
2121 }
2222
2323 // Get axe-core source (and configuration)
Original file line number Diff line number Diff line change @@ -46,9 +46,24 @@ describe('AxeInjector', () => {
4646 } ) ;
4747
4848 describe ( 'errorHandler' , ( ) => {
49+ // See https://github.com/dequelabs/axe-cli/issues/87.
50+ it ( 'writes to stderr (not stdout)' , ( ) => {
51+ const injector = new AxeInjector ( { driver : new MockWebDriver ( ) } ) ;
52+ const logSpy = sinon . spy ( console , 'log' ) ;
53+ const errorSpy = sinon . spy ( console , 'error' ) ;
54+
55+ injector . errorHandler ( ) ;
56+
57+ assert . equal ( logSpy . callCount , 0 ) ;
58+ logSpy . restore ( ) ;
59+
60+ assert . equal ( errorSpy . callCount , 1 ) ;
61+ errorSpy . restore ( ) ;
62+ } ) ;
63+
4964 it ( 'only logs once' , ( ) => {
5065 const injector = new AxeInjector ( { driver : new MockWebDriver ( ) } ) ;
51- const spy = sinon . spy ( console , 'log ' ) ;
66+ const spy = sinon . spy ( console , 'error ' ) ;
5267
5368 injector . errorHandler ( ) ;
5469 injector . errorHandler ( ) ;
You can’t perform that action at this time.
0 commit comments