@@ -102,6 +102,10 @@ const outdated = (dir, opts) => {
102102
103103t . beforeEach ( ( ) => logs = '' )
104104
105+ const { exitCode } = process
106+
107+ t . afterEach ( ( ) => process . exitCode = exitCode )
108+
105109const redactCwd = ( path ) => {
106110 const normalizePath = p => p
107111 . replace ( / \\ + / g, '/' )
@@ -175,6 +179,7 @@ t.test('should display outdated deps', t => {
175179 outdated ( null , {
176180 config : { global : true } ,
177181 } ) . exec ( [ ] , ( ) => {
182+ t . equal ( process . exitCode , 1 )
178183 t . matchSnapshot ( logs )
179184 t . end ( )
180185 } )
@@ -187,6 +192,7 @@ t.test('should display outdated deps', t => {
187192 } ,
188193 color : true ,
189194 } ) . exec ( [ ] , ( ) => {
195+ t . equal ( process . exitCode , 1 )
190196 t . matchSnapshot ( logs )
191197 t . end ( )
192198 } )
@@ -200,6 +206,7 @@ t.test('should display outdated deps', t => {
200206 } ,
201207 color : true ,
202208 } ) . exec ( [ ] , ( ) => {
209+ t . equal ( process . exitCode , 1 )
203210 t . matchSnapshot ( logs )
204211 t . end ( )
205212 } )
@@ -213,6 +220,7 @@ t.test('should display outdated deps', t => {
213220 } ,
214221 color : true ,
215222 } ) . exec ( [ ] , ( ) => {
223+ t . equal ( process . exitCode , 1 )
216224 t . matchSnapshot ( logs )
217225 t . end ( )
218226 } )
@@ -226,6 +234,7 @@ t.test('should display outdated deps', t => {
226234 } ,
227235 color : true ,
228236 } ) . exec ( [ ] , ( ) => {
237+ t . equal ( process . exitCode , 1 )
229238 t . matchSnapshot ( logs )
230239 t . end ( )
231240 } )
@@ -238,6 +247,7 @@ t.test('should display outdated deps', t => {
238247 long : true ,
239248 } ,
240249 } ) . exec ( [ ] , ( ) => {
250+ t . equal ( process . exitCode , 1 )
241251 t . matchSnapshot ( logs )
242252 t . end ( )
243253 } )
@@ -250,6 +260,7 @@ t.test('should display outdated deps', t => {
250260 json : true ,
251261 } ,
252262 } ) . exec ( [ ] , ( ) => {
263+ t . equal ( process . exitCode , 1 )
253264 t . matchSnapshot ( logs )
254265 t . end ( )
255266 } )
@@ -263,6 +274,7 @@ t.test('should display outdated deps', t => {
263274 long : true ,
264275 } ,
265276 } ) . exec ( [ ] , ( ) => {
277+ t . equal ( process . exitCode , 1 )
266278 t . matchSnapshot ( logs )
267279 t . end ( )
268280 } )
@@ -275,6 +287,7 @@ t.test('should display outdated deps', t => {
275287 parseable : true ,
276288 } ,
277289 } ) . exec ( [ ] , ( ) => {
290+ t . equal ( process . exitCode , 1 )
278291 t . matchSnapshot ( logs )
279292 t . end ( )
280293 } )
@@ -288,6 +301,7 @@ t.test('should display outdated deps', t => {
288301 long : true ,
289302 } ,
290303 } ) . exec ( [ ] , ( ) => {
304+ t . equal ( process . exitCode , 1 )
291305 t . matchSnapshot ( logs )
292306 t . end ( )
293307 } )
@@ -299,6 +313,7 @@ t.test('should display outdated deps', t => {
299313 all : true ,
300314 } ,
301315 } ) . exec ( [ ] , ( ) => {
316+ t . equal ( process . exitCode , 1 )
302317 t . matchSnapshot ( logs )
303318 t . end ( )
304319 } )
@@ -310,6 +325,7 @@ t.test('should display outdated deps', t => {
310325 global : false ,
311326 } ,
312327 } ) . exec ( [ 'cat' ] , ( ) => {
328+ t . equal ( process . exitCode , 1 )
313329 t . matchSnapshot ( logs )
314330 t . end ( )
315331 } )
@@ -341,6 +357,7 @@ t.test('should return if no outdated deps', t => {
341357 global : false ,
342358 } ) . exec ( [ ] , ( ) => {
343359 t . equal ( logs . length , 0 , 'no logs' )
360+ t . equal ( process . exitCode , 0 )
344361 t . end ( )
345362 } )
346363} )
@@ -388,6 +405,7 @@ t.test('should skip missing non-prod deps', t => {
388405 global : false ,
389406 } ) . exec ( [ ] , ( ) => {
390407 t . equal ( logs . length , 0 , 'no logs' )
408+ t . equal ( process . exitCode , 0 )
391409 t . end ( )
392410 } )
393411} )
@@ -413,6 +431,7 @@ t.test('should skip invalid pkg ranges', t => {
413431
414432 outdated ( testDir , { } ) . exec ( [ ] , ( ) => {
415433 t . equal ( logs . length , 0 , 'no logs' )
434+ t . equal ( process . exitCode , 0 )
416435 t . end ( )
417436 } )
418437} )
@@ -438,6 +457,7 @@ t.test('should skip git specs', t => {
438457
439458 outdated ( testDir , { } ) . exec ( [ ] , ( ) => {
440459 t . equal ( logs . length , 0 , 'no logs' )
460+ t . equal ( process . exitCode , 0 )
441461 t . end ( )
442462 } )
443463} )
@@ -540,6 +560,7 @@ t.test('workspaces', async t => {
540560 rej ( err )
541561
542562 t . matchSnapshot ( logs , 'should display ws outdated deps human output' )
563+ t . equal ( process . exitCode , 1 )
543564 res ( )
544565 } )
545566 } )
@@ -554,6 +575,7 @@ t.test('workspaces', async t => {
554575 rej ( err )
555576
556577 t . matchSnapshot ( logs , 'should display ws outdated deps json output' )
578+ t . equal ( process . exitCode , 1 )
557579 res ( )
558580 } )
559581 } )
@@ -568,6 +590,7 @@ t.test('workspaces', async t => {
568590 rej ( err )
569591
570592 t . matchSnapshot ( logs , 'should display ws outdated deps parseable output' )
593+ t . equal ( process . exitCode , 1 )
571594 res ( )
572595 } )
573596 } )
@@ -582,6 +605,7 @@ t.test('workspaces', async t => {
582605 rej ( err )
583606
584607 t . matchSnapshot ( logs , 'should display all dependencies' )
608+ t . equal ( process . exitCode , 1 )
585609 res ( )
586610 } )
587611 } )
@@ -594,6 +618,7 @@ t.test('workspaces', async t => {
594618 rej ( err )
595619
596620 t . matchSnapshot ( logs , 'should highlight ws in dependend by section' )
621+ t . equal ( process . exitCode , 1 )
597622 res ( )
598623 } )
599624 } )
@@ -604,6 +629,7 @@ t.test('workspaces', async t => {
604629 rej ( err )
605630
606631 t . matchSnapshot ( logs , 'should display results filtered by ws' )
632+ t . equal ( process . exitCode , 1 )
607633 res ( )
608634 } )
609635 } )
@@ -618,6 +644,7 @@ t.test('workspaces', async t => {
618644 rej ( err )
619645
620646 t . matchSnapshot ( logs , 'should display json results filtered by ws' )
647+ t . equal ( process . exitCode , 1 )
621648 res ( )
622649 } )
623650 } )
@@ -632,6 +659,7 @@ t.test('workspaces', async t => {
632659 rej ( err )
633660
634661 t . matchSnapshot ( logs , 'should display parseable results filtered by ws' )
662+ t . equal ( process . exitCode , 1 )
635663 res ( )
636664 } )
637665 } )
@@ -647,6 +675,7 @@ t.test('workspaces', async t => {
647675
648676 t . matchSnapshot ( logs ,
649677 'should display nested deps when filtering by ws and using --all' )
678+ t . equal ( process . exitCode , 1 )
650679 res ( )
651680 } )
652681 } )
@@ -658,6 +687,7 @@ t.test('workspaces', async t => {
658687
659688 t . matchSnapshot ( logs ,
660689 'should display no results if ws has no deps to display' )
690+ t . equal ( process . exitCode , 0 )
661691 res ( )
662692 } )
663693 } )
@@ -669,6 +699,7 @@ t.test('workspaces', async t => {
669699
670700 t . matchSnapshot ( logs ,
671701 'should display missing deps when filtering by ws' )
702+ t . equal ( process . exitCode , 1 )
672703 res ( )
673704 } )
674705 } )
0 commit comments