File tree 2 files changed +27
-0
lines changed
2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ const defaultConfig = {
23
23
} ;
24
24
25
25
let messages = { } ;
26
+ let unsilencedLogs = [ ] ;
26
27
let config = { } ;
27
28
28
29
const reset = function ( ) {
@@ -31,6 +32,7 @@ const reset = function() {
31
32
messages [ messageKey ] = [ ] ;
32
33
}
33
34
config = Object . assign ( { } , defaultConfig ) ;
35
+ unsilencedLogs = [ ] ;
34
36
} ;
35
37
reset ( ) ;
36
38
@@ -40,6 +42,7 @@ function log(message) {
40
42
}
41
43
42
44
console . log ( message ) ;
45
+ unsilencedLogs . push ( message ) ;
43
46
}
44
47
45
48
module . exports = {
@@ -73,6 +76,10 @@ module.exports = {
73
76
return messages ;
74
77
} ,
75
78
79
+ getUnsilencedLogs ( ) {
80
+ return unsilencedLogs ;
81
+ } ,
82
+
76
83
quiet ( setQuiet = true ) {
77
84
config . quiet = setQuiet ;
78
85
} ,
Original file line number Diff line number Diff line change
1
+ /*
2
+ * This file is part of the Symfony Webpack Encore package.
3
+ *
4
+ * (c) Fabien Potencier <fabien@symfony.com>
5
+ *
6
+ * For the full copyright and license information, please view the LICENSE
7
+ * file that was distributed with this source code.
8
+ */
9
+
10
+ 'use strict' ;
11
+
12
+ const logger = require ( '../lib/logger' ) ;
13
+
14
+ afterEach ( function ( ) {
15
+ const unsilencedLogs = logger . getUnsilencedLogs ( ) ;
16
+
17
+ if ( unsilencedLogs . length > 0 ) {
18
+ this . test . error ( new Error ( `There were ${ unsilencedLogs . length } un-silenced logs messages` ) ) ;
19
+ }
20
+ } ) ;
You can’t perform that action at this time.
0 commit comments