@@ -49,6 +49,14 @@ test('completes when the coverage is 100 and min_coverage is not provided', () =
49
49
cp . execSync ( `node ${ ip } ` , { env : process . env } ) . toString ( ) ;
50
50
} ) ;
51
51
52
+ test ( 'logs message when the coverage is 100 and min_coverage is not provided' , ( ) => {
53
+ const lcovPath = './fixtures/lcov.100.info' ;
54
+ process . env [ 'INPUT_PATH' ] = lcovPath ;
55
+ const ip = path . join ( __dirname , 'index.js' ) ;
56
+ let result = cp . execSync ( `node ${ ip } ` , { env : process . env } ) . toString ( ) ;
57
+ expect ( result ) . toContain ( 'Coverage: 100%.' ) ;
58
+ } ) ;
59
+
52
60
test ( 'completes when the coverage is higher than the threshold after excluding files' , ( ) => {
53
61
const lcovPath = './fixtures/lcov.100.info' ;
54
62
const exclude = '**/*_observer.dart' ;
@@ -84,13 +92,26 @@ test('fails when the coverage is below the min_coverage, even if we exclude file
84
92
}
85
93
} ) ;
86
94
87
- test ( 'completes when the coverage is above the given min_threshold' , ( ) => {
95
+ test ( 'show message when the coverage is above the given min_threshold' , ( ) => {
96
+ const lcovPath = './fixtures/lcov.95.info' ;
97
+ const minCoverage = 80 ;
98
+ process . env [ 'INPUT_PATH' ] = lcovPath ;
99
+ process . env [ 'INPUT_MIN_COVERAGE' ] = minCoverage ;
100
+ const ip = path . join ( __dirname , 'index.js' ) ;
101
+ cp . execSync ( `node ${ ip } ` , { env : process . env } ) . toString ( ) ;
102
+ } ) ;
103
+
104
+ test ( 'show message when the coverage is above the given min_threshold' , ( ) => {
88
105
const lcovPath = './fixtures/lcov.95.info' ;
89
106
const minCoverage = 80 ;
90
107
process . env [ 'INPUT_PATH' ] = lcovPath ;
91
108
process . env [ 'INPUT_MIN_COVERAGE' ] = minCoverage ;
92
109
const ip = path . join ( __dirname , 'index.js' ) ;
93
110
cp . execSync ( `node ${ ip } ` , { env : process . env } ) . toString ( ) ;
111
+ let result = cp . execSync ( `node ${ ip } ` , { env : process . env } ) . toString ( ) ;
112
+ expect ( result ) . toContain (
113
+ 'Coverage: 95%.\n95 is greater than or equal to min_coverage 80.'
114
+ ) ;
94
115
} ) ;
95
116
96
117
test ( 'fails when the coverage is below the given min_threshold' , ( ) => {
@@ -124,3 +145,16 @@ test('shows lines that are missing coverage when failure occurs', () => {
124
145
) ;
125
146
}
126
147
} ) ;
148
+
149
+ test ( 'shows lines that are missing coverage when coverage is less than 100%' , ( ) => {
150
+ const lcovPath = './fixtures/lcov.95.info' ;
151
+ const minCoverage = 80 ;
152
+ process . env [ 'INPUT_PATH' ] = lcovPath ;
153
+ process . env [ 'INPUT_MIN_COVERAGE' ] = minCoverage ;
154
+ const ip = path . join ( __dirname , 'index.js' ) ;
155
+ let result = cp . execSync ( `node ${ ip } ` , { env : process . env } ) . toString ( ) ;
156
+ expect ( result ) . toContain ( 'Lines not covered' ) ;
157
+ expect ( result ) . toContain (
158
+ '/Users/felix/Development/github.com/felangel/bloc/packages/bloc/lib/src/bloc_observer.dart: 20, 27, 36, 43, 51'
159
+ ) ;
160
+ } ) ;
0 commit comments