@@ -163,12 +163,21 @@ describe('WebpackConfig object', () => {
163
163
} ) ;
164
164
} ) ;
165
165
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
+
167
175
it ( 'Setting paths and callback' , ( ) => {
168
176
const config = createConfig ( ) ;
169
177
const callback = ( ) => { } ;
170
- config . configureCleanWebpackPlugin ( [ '**/*.js' , '**/*.css' ] , callback ) ;
178
+ config . cleanupOutputBeforeBuild ( [ '**/*.js' , '**/*.css' ] , callback ) ;
171
179
180
+ expect ( config . cleanupOutput ) . to . be . true ;
172
181
expect ( config . cleanWebpackPluginPaths ) . to . deep . equal ( [ '**/*.js' , '**/*.css' ] ) ;
173
182
expect ( config . cleanWebpackPluginOptionsCallback ) . to . equal ( callback ) ;
174
183
} ) ;
@@ -177,16 +186,16 @@ describe('WebpackConfig object', () => {
177
186
const config = createConfig ( ) ;
178
187
179
188
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' ) ;
182
191
} ) ;
183
192
184
193
it ( 'Setting invalid callback argument' , ( ) => {
185
194
const config = createConfig ( ) ;
186
195
187
196
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' ) ;
190
199
} ) ;
191
200
} ) ;
192
201
0 commit comments