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 {
17
17
18
18
this . didLogError = true ;
19
19
// 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!' ) ;
21
21
}
22
22
23
23
// Get axe-core source (and configuration)
Original file line number Diff line number Diff line change @@ -46,9 +46,24 @@ describe('AxeInjector', () => {
46
46
} ) ;
47
47
48
48
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
+
49
64
it ( 'only logs once' , ( ) => {
50
65
const injector = new AxeInjector ( { driver : new MockWebDriver ( ) } ) ;
51
- const spy = sinon . spy ( console , 'log ' ) ;
66
+ const spy = sinon . spy ( console , 'error ' ) ;
52
67
53
68
injector . errorHandler ( ) ;
54
69
injector . errorHandler ( ) ;
You can’t perform that action at this time.
0 commit comments