@@ -80,6 +80,28 @@ describe("execa-webpack-plugin", () => {
8080 } ) ;
8181 } ) ;
8282
83+ it ( "should works with `onBuildStart` and `dev` is `false` option" , ( ) => {
84+ mkdirSyncSafe ( dir ) ;
85+
86+ expect ( fs . statSync ( dir ) . isDirectory ( ) ) . toBe ( true ) ;
87+
88+ return run ( {
89+ dev : false ,
90+ onBuildStart : [
91+ {
92+ args : [ dir ] ,
93+ cmd : "del"
94+ }
95+ ]
96+ } ) . then ( ( ) => {
97+ expect ( ( ) => fs . statSync ( dir ) ) . toThrow ( ) ;
98+
99+ unlinkSyncSafe ( dir ) ;
100+
101+ return Promise . resolve ( ) ;
102+ } ) ;
103+ } ) ;
104+
83105 it ( "should works with `onBuildEnd` option" , ( ) => {
84106 mkdirSyncSafe ( dir ) ;
85107
@@ -101,6 +123,28 @@ describe("execa-webpack-plugin", () => {
101123 } ) ;
102124 } ) ;
103125
126+ it ( "should works with `onBuildEnd` and `dev` is `false` options" , ( ) => {
127+ mkdirSyncSafe ( dir ) ;
128+
129+ expect ( fs . statSync ( dir ) . isDirectory ( ) ) . toBe ( true ) ;
130+
131+ return run ( {
132+ dev : false ,
133+ onBuildEnd : [
134+ {
135+ args : [ dir ] ,
136+ cmd : "del"
137+ }
138+ ]
139+ } ) . then ( ( ) => {
140+ expect ( ( ) => fs . statSync ( dir ) ) . toThrow ( ) ;
141+
142+ unlinkSyncSafe ( dir ) ;
143+
144+ return Promise . resolve ( ) ;
145+ } ) ;
146+ } ) ;
147+
104148 it ( "should works with `onBuildExit` option" , ( ) => {
105149 mkdirSyncSafe ( dir ) ;
106150
@@ -122,6 +166,28 @@ describe("execa-webpack-plugin", () => {
122166 } ) ;
123167 } ) ;
124168
169+ it ( "should works with `onBuildExit` and `dev` is `false` options" , ( ) => {
170+ mkdirSyncSafe ( dir ) ;
171+
172+ expect ( fs . statSync ( dir ) . isDirectory ( ) ) . toBe ( true ) ;
173+
174+ return run ( {
175+ dev : false ,
176+ onBuildExit : [
177+ {
178+ args : [ dir ] ,
179+ cmd : "del"
180+ }
181+ ]
182+ } ) . then ( ( ) => {
183+ expect ( ( ) => fs . statSync ( dir ) ) . toThrow ( ) ;
184+
185+ unlinkSyncSafe ( dir ) ;
186+
187+ return Promise . resolve ( ) ;
188+ } ) ;
189+ } ) ;
190+
125191 it ( "should throw error with `bail: true` option" , ( ) => {
126192 let catchError = null ;
127193
@@ -185,37 +251,6 @@ describe("execa-webpack-plugin", () => {
185251 } ) ;
186252 } ) ;
187253
188- it ( "should throw error when nested commands return nothing" , ( ) => {
189- let catchError = null ;
190-
191- return run ( {
192- bail : true ,
193- logLevel : "silent" ,
194- onBuildStart : [
195- {
196- args : [
197- {
198- args : [ path . join ( resourcesDir , "nothing.js" ) ] ,
199- cmd : "node"
200- }
201- ] ,
202- cmd : "del"
203- }
204- ]
205- } )
206- . catch ( error => {
207- catchError = error ;
208-
209- return Promise . resolve ( ) ;
210- } )
211- . then ( ( ) => {
212- expect ( catchError ) . toBeInstanceOf ( Error ) ;
213- expect ( catchError ) . not . toBeNull ( ) ;
214-
215- return Promise . resolve ( ) ;
216- } ) ;
217- } ) ;
218-
219254 it ( "should works when nested commands return nothing and 'bail: false'" , ( ) => {
220255 let catchError = null ;
221256
0 commit comments