karma-parallel icon indicating copy to clipboard operation
karma-parallel copied to clipboard

karma-parallel do not return exit code 1 anymore on too low code coverage

Open petrce opened this issue 6 years ago • 7 comments

  • I'm submitting a

    • [x] bug report
  • What is the current behavior? when I run Istanbul code coverage using: ng test --source-map --code-coverage tests do not return exit code 1 on code coverage below threshold anymore, so it is hard to detect coverage errors in CI

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

  1. set the threshold for code coverage using Istanbul in karma.conf
    coverageIstanbulReporter: {
      dir: require('path').join(__dirname, '../coverage'),
      reports: ['html', 'lcov', 'text', 'text-summary', 'cobertura'],
      fixWebpackSourcePaths: true,
      thresholds: {
        statements: 100,
        lines: 100,
        branches: 100,
        functions: 100
      }
    },
  1. run ng test --source-map --code-coverage
  • What is the expected behavior? ng test --source-map --code-coverage tests should return exit code 1 on code coverage below threshold

  • Please tell us about your environment:

  • version: 0.3.1
  • Browser: Chrome Version 72.0.3626.121 (Official Build) (64-bit)
  • Language: TypeScript 3.2.4, Angular 7

petrce avatar Mar 11 '19 22:03 petrce

workaround in poweshell:

$allOutput = & ng test --source-map --code-coverage 2>&1
echo $allOutput

if ($allOutput -cmatch 'ERROR')
{
    echo $matches
    Write-Error "(FAILED)"
}

petrce avatar Mar 15 '19 07:03 petrce

What version of karma are you using?

joeljeske avatar Mar 16 '19 02:03 joeljeske

Having the same issue. Using karma 4.0.1 and karma-coverage-istanbul-reporter 2.0.5. Also using the same TypeScript and Angular 7

nukithelegend avatar Mar 18 '19 08:03 nukithelegend

I have not yet tested with karma v4. Can you try downgrading to v3.x to see if that fixes it?

I’ll try to support v4, just seeing if that’s related.

joeljeske avatar Mar 18 '19 12:03 joeljeske

Just to update, I'm seeing this issue still as well.

angular 8.2.4 angular/cli 8.3.2 karma 4.2.0 karma-parallel 0.3.1 karma-coverage-istanbul-reporter 2.0.6

ericcarino avatar Mar 21 '20 00:03 ericcarino

Could you create a reproduction repo? I don’t use angular nor Istanbul in my normal processes.

joeljeske avatar Mar 21 '20 00:03 joeljeske

@joeljeske here you go!

https://github.com/ericcarino/karma_parallel_bug

ericcarino avatar Mar 22 '20 05:03 ericcarino