@@ -22,8 +22,38 @@ test('empty LCOV throws an error', () => {
22
22
} catch ( err ) {
23
23
expect ( err ) . toBeDefined ( ) ;
24
24
25
- const errorMessage = err . stdout . toString ( ) ;
26
- expect ( errorMessage ) . toContain ( 'lcov is empty!' ) ;
25
+ const errorMessage = err . stdout . toString ( ) . replace ( / % 0 A / g, '\n' ) ;
26
+ expect ( errorMessage ) . toContain (
27
+ `❌ Found an empty lcov file at "${ lcovPath } ".
28
+ An empty lcov file was found but with no coverage data. This might be because \
29
+ you have no test files or your tests are not generating any coverage data.
30
+ `
31
+ ) ;
32
+ }
33
+ } ) ;
34
+
35
+ test ( 'non-existent LCOV throws an error' , ( ) => {
36
+ const lcovPath = './fixtures/not-found.info' ;
37
+ process . env [ 'INPUT_PATH' ] = lcovPath ;
38
+ const ip = path . join ( __dirname , 'index.js' ) ;
39
+ try {
40
+ cp . execSync ( `node ${ ip } ` , { env : process . env } ) ;
41
+ fail ( 'this code should fail' ) ;
42
+ } catch ( err ) {
43
+ expect ( err ) . toBeDefined ( ) ;
44
+
45
+ const errorMessage = err . stdout . toString ( ) . replace ( / % 0 A / g, '\n' ) ;
46
+ expect ( errorMessage ) . toContain (
47
+ `❌ Failed to find an lcov file at ${ lcovPath } .
48
+ Make sure to generate an lcov file before running VeryGoodCoverage and set the \
49
+ path input to the correct location.
50
+
51
+ For example:
52
+ uses: VeryGoodOpenSource/very_good_coverage@v2
53
+ with:
54
+ path: 'my_project/coverage/lcov.info'
55
+ `
56
+ ) ;
27
57
}
28
58
} ) ;
29
59
0 commit comments