File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change
1
+ // tslint:disable:no-console
2
+ import { Logger } from '.' ;
3
+
4
+ const defaultLogger : Logger = {
5
+ // since `console.warn` is an alias to `console.error`,
6
+ // and `console.error` is really only a `console.info` for stderr
7
+ // instead of stdout, these are all equivalent by default.
8
+ error : console . error ,
9
+ warn : console . error ,
10
+ info : console . error
11
+ } ;
12
+
13
+ export default defaultLogger ;
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import { createDefaultFormatter } from './formatter/defaultFormatter';
16
16
import { createCodeframeFormatter } from './formatter/codeframeFormatter' ;
17
17
import { fileExistsSync } from './FsHelper' ;
18
18
import { Message } from './Message' ;
19
+ import defaultLogger from './defaultLogger' ;
19
20
20
21
import {
21
22
getForkTsCheckerWebpackPluginHooks ,
@@ -164,7 +165,7 @@ class ForkTsCheckerWebpackPlugin {
164
165
this . ignoreLints = options . ignoreLints || [ ] ;
165
166
this . ignoreLintWarnings = options . ignoreLintWarnings === true ;
166
167
this . reportFiles = options . reportFiles || [ ] ;
167
- this . logger = options . logger || console ;
168
+ this . logger = options . logger || defaultLogger ;
168
169
this . silent = options . silent === true ; // default false
169
170
this . async = options . async !== false ; // default true
170
171
this . checkSyntacticErrors = options . checkSyntacticErrors === true ; // default false
Original file line number Diff line number Diff line change 2
2
import fs from 'fs' ;
3
3
import path from 'path' ;
4
4
import ForkTsCheckerWebpackPlugin from '../../lib/index' ;
5
+ import defaultLogger from '../../lib/defaultLogger' ;
5
6
import * as helpers from './helpers' ;
6
7
import { cloneDeep } from 'lodash' ;
7
8
import unixify from 'unixify' ;
@@ -49,10 +50,10 @@ describe.each([[true], [false]])(
49
50
expect ( plugin [ 'tslint' ] ) . toBe ( true ) ;
50
51
} ) ;
51
52
52
- it ( 'should set logger to console by default' , ( ) => {
53
+ it ( 'should set logger to the default logger by default' , ( ) => {
53
54
const plugin = new ForkTsCheckerWebpackPlugin ( { } ) ;
54
55
55
- expect ( plugin [ 'logger' ] ) . toBe ( console ) ;
56
+ expect ( plugin [ 'logger' ] ) . toBe ( defaultLogger ) ;
56
57
} ) ;
57
58
58
59
it ( 'should set watch to empty array by default' , ( ) => {
You can’t perform that action at this time.
0 commit comments