angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Code Coverage Doesn't print to log

Open georgeedwards opened this issue 9 years ago • 6 comments

OS?

Windows 10

Versions.

>ng --version
angular-cli: 1.0.0-beta.21
node: 6.9.2
os: win32 x64

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc. No, cli generated project - although not sure it would matter?

The log given by the failure.

Normally this include a stack trace and some more information.

>ng test --code-coverage -sr
16 12 2016 17:01:19.300:INFO [karma]: Karma v1.3.0 server started at http://localhost:9876/
16 12 2016 17:01:19.305:INFO [launcher]: Launching browser Chrome with unlimited concurrency
16 12 2016 17:01:19.326:INFO [launcher]: Starting browser Chrome
16 12 2016 17:01:31.883:INFO [Chrome 54.0.2840 (Windows 10 0.0.0)]: Connected on socket /#bBs3C5TU2REBI4NoAAAA with id 75263073
Chrome 54.0.2840 (Windows 10 0.0.0): Executed 23 of 23 SUCCESS (4.471 secs / 4.363 secs)
16 12 2016 17:01:41.478:WARN [launcher]: Chrome was not killed in 2000 ms, sending SIGKILL.

Mention any other details that might be useful.

There isn't any Code Coverage info printed in the log? Although a coverage dir is created in the project root.


Thanks! We'll be in touch soon.

georgeedwards avatar Dec 16 '16 17:12 georgeedwards

You would need to add this to the Karma configuration file yourself. I don't think this should be a standard thing that's forced on everyone.

lordmat0 avatar Dec 16 '16 18:12 lordmat0

Would be nice to see it as an optional command line flag.

mattdistefano avatar Dec 16 '16 22:12 mattdistefano

Yes I agree:

  1. I don't think having a cli flag that doesn't modify the log output at all is very intuitive
  2. For a wide range of use cases (e.g. CI) build files may not be convenient to access, where as logs are.

This seems to be a pretty integral part of code coverage reporting and is something I definitely feel should be an option in this cli.

georgeedwards avatar Dec 17 '16 10:12 georgeedwards

I also attempted to modify my karma-conf to make it error out and it did not work because the CLI does not pass the proper configs down.

See this issue. https://github.com/angular/angular-cli/issues/3435

JT-Bruch avatar Dec 19 '16 19:12 JT-Bruch

For the time being you can add text-summary in reports under coverageIstanbulReporter in the karma.conf.js file

    coverageIstanbulReporter: {
      dir: require('path').join(__dirname, '<%= relativePathToWorkspaceRoot %>/coverage'),
      reports: ['html', 'lcovonly', 'text-summary'],
      fixWebpackSourcePaths: true
    },

alan-agius4 avatar Oct 10 '18 08:10 alan-agius4

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.