@@ -12,30 +12,28 @@ jest.afterEach(() => {
12
12
13
13
jest . test ( 'action has empty error' , ( ) => {
14
14
process . env [ workflowsPath ] = 'test/stub/empty' ;
15
+ let result ;
15
16
16
17
try {
17
- cp . execSync ( `node ${ ip } ` , { env : process . env } ) . toString ( ) ;
18
-
19
- jest . expect ( true ) . toBe ( false ) ;
18
+ throw cp . execSync ( `node ${ ip } ` , { env : process . env } ) . toString ( ) ;
20
19
} catch ( error ) {
21
- const result = error . stdout . toString ( ) ;
22
-
23
- jest . expect ( result ) . toContain ( 'Cannot read properties of null (reading \'jobs\')' ) ;
24
- jest . expect ( result ) . not . toContain ( 'No issues were found.' ) ;
20
+ result = ( error . stdout || error ) . toString ( ) ;
25
21
}
22
+
23
+ jest . expect ( result ) . toContain ( 'Cannot read properties of null (reading \'jobs\')' ) ;
24
+ jest . expect ( result ) . not . toContain ( 'No issues were found.' ) ;
26
25
} ) ;
27
26
28
27
jest . test ( 'action has unpinned error' , ( ) => {
29
28
process . env [ workflowsPath ] = 'test/stub/unpinned' ;
29
+ let result ;
30
30
31
31
try {
32
- cp . execSync ( `node ${ ip } ` , { env : process . env } ) . toString ( ) ;
33
-
34
- jest . expect ( true ) . toBe ( false ) ;
32
+ throw cp . execSync ( `node ${ ip } ` , { env : process . env } ) . toString ( ) ;
35
33
} catch ( error ) {
36
- const result = error . stdout . toString ( ) ;
37
-
38
- jest . expect ( result ) . toContain ( 'actions/checkout@v1 is not pinned to a full length commit SHA.' ) ;
39
- jest . expect ( result ) . not . toContain ( 'No issues were found.' ) ;
34
+ result = ( error . stdout || error ) . toString ( ) ;
40
35
}
36
+
37
+ jest . expect ( result ) . toContain ( 'actions/checkout@v1 is not pinned to a full length commit SHA.' ) ;
38
+ jest . expect ( result ) . not . toContain ( 'No issues were found.' ) ;
41
39
} ) ;
0 commit comments