@@ -15,7 +15,7 @@ const RuntimeConfig = require('../lib/config/RuntimeConfig');
15
15
const path = require ( 'path' ) ;
16
16
const fs = require ( 'fs' ) ;
17
17
const webpack = require ( 'webpack' ) ;
18
- const logger = require ( '../lib /logger' ) ;
18
+ const loggerAssert = require ( './helpers /logger-assert ' ) ;
19
19
20
20
function createConfig ( ) {
21
21
const runtimeConfig = new RuntimeConfig ( ) ;
@@ -139,11 +139,9 @@ describe('WebpackConfig object', () => {
139
139
140
140
it ( 'You can omit the opening slash, but get a warning' , ( ) => {
141
141
const config = createConfig ( ) ;
142
- logger . reset ( ) ;
143
- logger . quiet ( ) ;
144
142
145
143
config . setPublicPath ( 'foo' ) ;
146
- expect ( logger . getMessages ( ) . warning ) . to . have . lengthOf ( 1 ) ;
144
+ loggerAssert . assertWarning ( 'TODO' ) ;
147
145
} ) ;
148
146
} ) ;
149
147
@@ -206,10 +204,8 @@ describe('WebpackConfig object', () => {
206
204
it ( 'You can use an opening slash, but get a warning' , ( ) => {
207
205
const config = createConfig ( ) ;
208
206
209
- logger . reset ( ) ;
210
- logger . quiet ( ) ;
211
207
config . setManifestKeyPrefix ( '/foo/' ) ;
212
- expect ( logger . getMessages ( ) . warning ) . to . have . lengthOf ( 1 ) ;
208
+ loggerAssert . assertWarning ( 'TODO' ) ;
213
209
} ) ;
214
210
} ) ;
215
211
@@ -593,15 +589,6 @@ describe('WebpackConfig object', () => {
593
589
} ) ;
594
590
595
591
describe ( 'configureBabel' , ( ) => {
596
- beforeEach ( ( ) => {
597
- logger . reset ( ) ;
598
- logger . quiet ( ) ;
599
- } ) ;
600
-
601
- afterEach ( ( ) => {
602
- logger . quiet ( false ) ;
603
- } ) ;
604
-
605
592
it ( 'Calling method sets it' , ( ) => {
606
593
const config = createConfig ( ) ;
607
594
const testCallback = ( ) => { } ;
@@ -668,26 +655,22 @@ describe('WebpackConfig object', () => {
668
655
config . runtimeConfig . babelRcFileExists = true ;
669
656
config . configureBabel ( ( ) => { } ) ;
670
657
671
- const warnings = logger . getMessages ( ) . warning ;
672
- expect ( warnings ) . to . have . lengthOf ( 1 ) ;
673
- expect ( warnings [ 0 ] ) . to . contain ( 'your app already provides an external Babel configuration' ) ;
658
+ loggerAssert . assertWarning ( 'your app already provides an external Babel configuration' ) ;
674
659
} ) ;
675
660
676
661
it ( 'Calling with a whitelisted option when .babelrc is present works fine' , ( ) => {
677
662
const config = createConfig ( ) ;
678
663
config . runtimeConfig . babelRcFileExists = true ;
679
664
config . configureBabel ( null , { includeNodeModules : [ 'foo' ] } ) ;
680
- expect ( logger . getMessages ( ) . warning ) . to . be . empty ;
665
+ loggerAssert . assertWarning ( 'TODO' ) ;
681
666
} ) ;
682
667
683
668
it ( 'Calling with a non-whitelisted option when .babelrc is present displays a warning' , ( ) => {
684
669
const config = createConfig ( ) ;
685
670
config . runtimeConfig . babelRcFileExists = true ;
686
671
config . configureBabel ( null , { useBuiltIns : 'foo' } ) ;
687
672
688
- const warnings = logger . getMessages ( ) . warning ;
689
- expect ( warnings ) . to . have . lengthOf ( 1 ) ;
690
- expect ( warnings [ 0 ] ) . to . contain ( 'your app already provides an external Babel configuration' ) ;
673
+ loggerAssert . assertWarning ( 'your app already provides an external Babel configuration' ) ;
691
674
} ) ;
692
675
693
676
it ( 'Pass invalid config' , ( ) => {
@@ -716,15 +699,6 @@ describe('WebpackConfig object', () => {
716
699
} ) ;
717
700
718
701
describe ( 'configureBabelPresetEnv' , ( ) => {
719
- beforeEach ( ( ) => {
720
- logger . reset ( ) ;
721
- logger . quiet ( ) ;
722
- } ) ;
723
-
724
- afterEach ( ( ) => {
725
- logger . quiet ( false ) ;
726
- } ) ;
727
-
728
702
it ( 'Calling method sets it' , ( ) => {
729
703
const config = createConfig ( ) ;
730
704
const testCallback = ( ) => { } ;
0 commit comments