Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update to fail the job if the patterns are invalid #626

Merged
11 changes: 3 additions & 8 deletions src/__tests__/main.test.ts
Expand Up @@ -385,12 +385,7 @@ test('warnings are logged when files are not found', async () => {
INPUT_FILES: 'src/__tests__/not-found.txt'
})

// @ts-ignore
core.warning = jest.fn()

await run()

expect(core.warning).toHaveBeenCalledWith(
'No paths found using the specified patterns'
)
const expectedError = new Error('No paths found using the specified patterns')

jackton1 marked this conversation as resolved.
Show resolved Hide resolved
jackton1 marked this conversation as resolved.
Show resolved Hide resolved
await expect(run()).rejects.toThrow(expectedError)
})
2 changes: 1 addition & 1 deletion src/main.ts
Expand Up @@ -277,7 +277,7 @@ export async function run(): Promise<void> {
core.saveState('paths-output-file', pathsOutputFile)
core.info(`Successfully created paths-output-file: ${pathsOutputFile}`)
} else if (hasCustomPatterns) {
core.warning('No paths found using the specified patterns')
core.setFailed('No paths found using the specified patterns')
}

core.setOutput('paths', pathsOutput)
Expand Down