@@ -3,7 +3,12 @@ process.env.RUN_MODE = 'cli'
33
44import yargs from 'yargs/yargs'
55import { hideBin } from 'yargs/helpers'
6- import { exitActionOnFail , getAllGitHubContext , handleError } from '../github'
6+ import {
7+ exitActionOnFail ,
8+ exitActionOnEmpty ,
9+ getAllGitHubContext ,
10+ handleError
11+ } from '../github'
712import { prepareReport } from '../ctrf'
813import { handleViewsAndComments , handleAnnotations } from '../github/handler'
914import { getCliInputs } from '../core/inputs'
@@ -39,6 +44,7 @@ export interface Arguments {
3944 results ?: number
4045 exitOnNoFiles ?: boolean
4146 exitOnFail ?: boolean
47+ exitOnEmpty ?: boolean
4248 fetchPreviousResults ?: boolean
4349 reportOrder ?: string
4450 maxWorkflowRunsToCheck ?: number
@@ -327,6 +333,11 @@ async function main(): Promise<void> {
327333 description : 'Fail action when if tests fail' ,
328334 default : false
329335 } )
336+ . options ( 'exit-on-empty' , {
337+ type : 'boolean' ,
338+ description : 'Fail action when if no tests are found' ,
339+ default : false
340+ } )
330341 . options ( 'update-comment' , {
331342 type : 'boolean' ,
332343 description : 'Updates existing Pull Request comment' ,
@@ -385,6 +396,9 @@ async function main(): Promise<void> {
385396
386397 await processPrComment ( argv , report , inputs )
387398
399+ if ( inputs . exitOnEmpty ) {
400+ exitActionOnEmpty ( report )
401+ }
388402 if ( inputs . exitOnFail ) {
389403 exitActionOnFail ( report )
390404 }
0 commit comments