File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ function createDebug(namespace) {
110110 // apply env-specific formatting (colors, etc.)
111111 exports . formatArgs . call ( self , args ) ;
112112
113- var logFn = enabled . log || exports . log || console . log . bind ( console ) ;
113+ var logFn = debug . log || exports . log || console . log . bind ( console ) ;
114114 logFn . apply ( self , args ) ;
115115 }
116116
Original file line number Diff line number Diff line change 11import { expect } from 'chai' ;
2+ import { assert , spy } from 'sinon' ;
23
34import debug from '../index' ;
45
@@ -9,4 +10,22 @@ describe('debug', () => {
910 log ( 'hello world' ) ;
1011 } ) ;
1112 } ) ;
12- } )
13+
14+ describe ( 'custom functions' , ( ) => {
15+ let log ;
16+
17+ beforeEach ( ( ) => {
18+ debug . enable ( 'test' ) ;
19+ log = debug ( 'test' ) ;
20+ } ) ;
21+
22+ context ( 'with log function' , ( ) => {
23+ it ( 'uses it' , ( ) => {
24+ log . log = spy ( ) ;
25+ log ( 'using custom log function' ) ;
26+
27+ assert . calledOnce ( log . log ) ;
28+ } ) ;
29+ } ) ;
30+ } ) ;
31+ } ) ;
You can’t perform that action at this time.
0 commit comments