@@ -15,7 +15,7 @@ const RuntimeConfig = require('../lib/config/RuntimeConfig');
1515const path = require ( 'path' ) ;
1616const fs = require ( 'fs' ) ;
1717const webpack = require ( 'webpack' ) ;
18- const logger = require ( '../lib /logger' ) ;
18+ const loggerAssert = require ( './helpers /logger-assert ' ) ;
1919
2020function createConfig ( ) {
2121 const runtimeConfig = new RuntimeConfig ( ) ;
@@ -139,11 +139,9 @@ describe('WebpackConfig object', () => {
139139
140140 it ( 'You can omit the opening slash, but get a warning' , ( ) => {
141141 const config = createConfig ( ) ;
142- logger . reset ( ) ;
143- logger . quiet ( ) ;
144142
145143 config . setPublicPath ( 'foo' ) ;
146- expect ( logger . getMessages ( ) . warning ) . to . have . lengthOf ( 1 ) ;
144+ loggerAssert . assertWarning ( 'TODO' ) ;
147145 } ) ;
148146 } ) ;
149147
@@ -206,10 +204,8 @@ describe('WebpackConfig object', () => {
206204 it ( 'You can use an opening slash, but get a warning' , ( ) => {
207205 const config = createConfig ( ) ;
208206
209- logger . reset ( ) ;
210- logger . quiet ( ) ;
211207 config . setManifestKeyPrefix ( '/foo/' ) ;
212- expect ( logger . getMessages ( ) . warning ) . to . have . lengthOf ( 1 ) ;
208+ loggerAssert . assertWarning ( 'TODO' ) ;
213209 } ) ;
214210 } ) ;
215211
@@ -593,15 +589,6 @@ describe('WebpackConfig object', () => {
593589 } ) ;
594590
595591 describe ( 'configureBabel' , ( ) => {
596- beforeEach ( ( ) => {
597- logger . reset ( ) ;
598- logger . quiet ( ) ;
599- } ) ;
600-
601- afterEach ( ( ) => {
602- logger . quiet ( false ) ;
603- } ) ;
604-
605592 it ( 'Calling method sets it' , ( ) => {
606593 const config = createConfig ( ) ;
607594 const testCallback = ( ) => { } ;
@@ -668,26 +655,22 @@ describe('WebpackConfig object', () => {
668655 config . runtimeConfig . babelRcFileExists = true ;
669656 config . configureBabel ( ( ) => { } ) ;
670657
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' ) ;
674659 } ) ;
675660
676661 it ( 'Calling with a whitelisted option when .babelrc is present works fine' , ( ) => {
677662 const config = createConfig ( ) ;
678663 config . runtimeConfig . babelRcFileExists = true ;
679664 config . configureBabel ( null , { includeNodeModules : [ 'foo' ] } ) ;
680- expect ( logger . getMessages ( ) . warning ) . to . be . empty ;
665+ loggerAssert . assertWarning ( 'TODO' ) ;
681666 } ) ;
682667
683668 it ( 'Calling with a non-whitelisted option when .babelrc is present displays a warning' , ( ) => {
684669 const config = createConfig ( ) ;
685670 config . runtimeConfig . babelRcFileExists = true ;
686671 config . configureBabel ( null , { useBuiltIns : 'foo' } ) ;
687672
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' ) ;
691674 } ) ;
692675
693676 it ( 'Pass invalid config' , ( ) => {
@@ -716,15 +699,6 @@ describe('WebpackConfig object', () => {
716699 } ) ;
717700
718701 describe ( 'configureBabelPresetEnv' , ( ) => {
719- beforeEach ( ( ) => {
720- logger . reset ( ) ;
721- logger . quiet ( ) ;
722- } ) ;
723-
724- afterEach ( ( ) => {
725- logger . quiet ( false ) ;
726- } ) ;
727-
728702 it ( 'Calling method sets it' , ( ) => {
729703 const config = createConfig ( ) ;
730704 const testCallback = ( ) => { } ;
0 commit comments