davelosert/vitest-coverage-report-action

Test step not failing when under the threshold

Wilgauf opened this issue · 2 comments

Hey, Just got it set up and working, but the Run tests step associated with reporting the coverage is not failing when test coverage is below the set threshold. Is there a way to configure it to do that? Ideally I want to be able to limit PRs that don't meet the standards.

Here are the settings I have:

    test: { 
      globals: true,
       environment: 'jsdom',
       setupFiles: ['./src/setupTests.ts'],
       pool: 'forks',
       coverage: {
           reporter: ['text', 'json', 'html', 'json-summary'],
           reportOnFailure: true,
           coverage: {
               lines: 60,
              branches: 60,
               functions: 60,
               statements: 60,
           },
       },
   },

Thanks

Hey @Wilgauf,

this is a possible duplicate to #314.

This action is deliberately just a reporting library. If you want to have a failing workflow when not meeting the test-coverage, this should happen in the test-step of your workflow already, and you can then use the if: always() setting to still generate the coverage report.

I am closing this for now as there was no further communication, and as I believe it is not a bug in this action, but rather a not-met expectations in it's usage.

If you disagree, feel free to reopen! 🙂