@@ -49,6 +49,14 @@ test('completes when the coverage is 100 and min_coverage is not provided', () =
4949 cp . execSync ( `node ${ ip } ` , { env : process . env } ) . toString ( ) ;
5050} ) ;
5151
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+
5260test ( 'completes when the coverage is higher than the threshold after excluding files' , ( ) => {
5361 const lcovPath = './fixtures/lcov.100.info' ;
5462 const exclude = '**/*_observer.dart' ;
@@ -84,13 +92,26 @@ test('fails when the coverage is below the min_coverage, even if we exclude file
8492 }
8593} ) ;
8694
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' , ( ) => {
88105 const lcovPath = './fixtures/lcov.95.info' ;
89106 const minCoverage = 80 ;
90107 process . env [ 'INPUT_PATH' ] = lcovPath ;
91108 process . env [ 'INPUT_MIN_COVERAGE' ] = minCoverage ;
92109 const ip = path . join ( __dirname , 'index.js' ) ;
93110 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+ ) ;
94115} ) ;
95116
96117test ( 'fails when the coverage is below the given min_threshold' , ( ) => {
@@ -124,3 +145,16 @@ test('shows lines that are missing coverage when failure occurs', () => {
124145 ) ;
125146 }
126147} ) ;
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