@@ -163,12 +163,21 @@ describe('WebpackConfig object', () => {
163163 } ) ;
164164 } ) ;
165165
166- describe ( 'configureCleanWebpackPlugin' , ( ) => {
166+ describe ( 'cleanupOutputBeforeBuild' , ( ) => {
167+ it ( 'Enabling it with default settings' , ( ) => {
168+ const config = createConfig ( ) ;
169+ config . cleanupOutputBeforeBuild ( ) ;
170+
171+ expect ( config . cleanupOutput ) . to . be . true ;
172+ expect ( config . cleanWebpackPluginPaths ) . to . deep . equal ( [ '**/*' ] ) ;
173+ } ) ;
174+
167175 it ( 'Setting paths and callback' , ( ) => {
168176 const config = createConfig ( ) ;
169177 const callback = ( ) => { } ;
170- config . configureCleanWebpackPlugin ( [ '**/*.js' , '**/*.css' ] , callback ) ;
178+ config . cleanupOutputBeforeBuild ( [ '**/*.js' , '**/*.css' ] , callback ) ;
171179
180+ expect ( config . cleanupOutput ) . to . be . true ;
172181 expect ( config . cleanWebpackPluginPaths ) . to . deep . equal ( [ '**/*.js' , '**/*.css' ] ) ;
173182 expect ( config . cleanWebpackPluginOptionsCallback ) . to . equal ( callback ) ;
174183 } ) ;
@@ -177,16 +186,16 @@ describe('WebpackConfig object', () => {
177186 const config = createConfig ( ) ;
178187
179188 expect ( ( ) => {
180- config . configureCleanWebpackPlugin ( 'foo' , ( ) => { } ) ;
181- } ) . to . throw ( 'Argument 1 to configureCleanWebpackPlugin () must be an Array' ) ;
189+ config . cleanupOutputBeforeBuild ( 'foo' , ( ) => { } ) ;
190+ } ) . to . throw ( 'Argument 1 to cleanupOutputBeforeBuild () must be an Array' ) ;
182191 } ) ;
183192
184193 it ( 'Setting invalid callback argument' , ( ) => {
185194 const config = createConfig ( ) ;
186195
187196 expect ( ( ) => {
188- config . configureCleanWebpackPlugin ( [ '**/*' ] , 'foo' ) ;
189- } ) . to . throw ( 'Argument 2 to configureCleanWebpackPlugin () must be a callback function' ) ;
197+ config . cleanupOutputBeforeBuild ( [ '**/*' ] , 'foo' ) ;
198+ } ) . to . throw ( 'Argument 2 to cleanupOutputBeforeBuild () must be a callback function' ) ;
190199 } ) ;
191200 } ) ;
192201
0 commit comments