Giter VIP home page Giter VIP logo

Comments (13)

gotwarlost avatar gotwarlost commented on June 9, 2024 1

Created a textreport branch on which this change is committed. @davglass I'm looking for your feedback on command line interface and report behavior. Please check out this branch, try it out and let me know.

cover and test commands have the following new option:

  --console <type>
          type of report to print to console, one of summary (default),
          detail, both or none

summary produces something like this:

=============================== Coverage summary ===============================
Statements   : 71.43% ( 10/14 )
Branches     : 66.67% ( 4/6 )
Functions    : 60% ( 3/5 )
Lines        : 71.43% ( 10/14 )
================================================================================

detail produces something like this

--------------------------+-----------+-----------+-----------+-----------+
File                      |   % Stmts |% Branches |   % Funcs |   % Lines |
--------------------------+-----------+-----------+-----------+-----------+
   lib/                   |     66.67 |        50 |        50 |     66.67 |
      bar.js              |        40 |         0 |         0 |        40 |
      foo.js              |       100 |       100 |       100 |       100 |
   lib/util/              |       100 |       100 |       100 |       100 |
      generate-names.js   |       100 |       100 |       100 |       100 |
   vendor/                |     66.67 |       100 |        50 |     66.67 |
      dummy_vendor_lib.js |     66.67 |       100 |        50 |     66.67 |
--------------------------+-----------+-----------+-----------+-----------+
All files                 |     71.43 |     66.67 |        60 |     71.43 |
--------------------------+-----------+-----------+-----------+-----------+

from istanbul.

gotwarlost avatar gotwarlost commented on June 9, 2024 1

Calling done. @davglass I'm going to nuke the textreport branch once you confirm you are not using it in any way. Note that the branch also has the backwards-incompatible --print change.

from istanbul.

gotwarlost avatar gotwarlost commented on June 9, 2024

How about we split this into two tickets, one for the small text output and another to enforce coverage. The latter needs some thought on interface whereas the former is more of typing work.

Also, Istanbul refrains from explicitly exiting from the process since stdout/ stderr may not fully flush etc. if it gets into this business and could interfere with other exit handlers that the app under test could have set up. So some thinking on that is required before we do the process.exit(1) thing.

I will create a new issue for the exit(1) thing

from istanbul.

davglass avatar davglass commented on June 9, 2024

I love this:
https://travis-ci.org/#!/yui/node-cssmin/jobs/2797430

My "only" recommendation is to not use full system paths when printing, use relative to this directory.

These can get pretty long if the directory tree (think a hudson workspace) is deeply nested.

from istanbul.

gotwarlost avatar gotwarlost commented on June 9, 2024

That full filesystem path appears when you have a single file under test. When there are multiple files the common prefix is stripped. I need to add handling so that the entire directory path is nuked when a single file is involved.

I will fix this as a separate issue.

from istanbul.

davglass avatar davglass commented on June 9, 2024

Thanks, other than that I love it. I've already put this branch into several of my CLI tools so I can see a coverage report via Travis :)

from istanbul.

gotwarlost avatar gotwarlost commented on June 9, 2024

The only thing that is stopping me from merging this branch is the name of the --console option. Could you suggest an alternative? Maybe --print ?

from istanbul.

davglass avatar davglass commented on June 9, 2024

I'm fine with --print

from istanbul.

davglass avatar davglass commented on June 9, 2024

Can you make this a method that I can use when istanbul is required? This way my CLI tools that gather coverage can print the exact same report.

from istanbul.

gotwarlost avatar gotwarlost commented on June 9, 2024

On the browser? It's already available for node using the Report mechanism. (i.e. istanbul.Report.create('text-summary') etc.)

Browser is a harder problem since the report infrastructure is not set up to run on a browser.

from istanbul.

davglass avatar davglass commented on June 9, 2024

Nice, that's what I needed..

from istanbul.

davglass avatar davglass commented on June 9, 2024

All of my modules have been switched over to the lastest istanbul on npm, so you can nuke the branch all you want.

FYI, I ❤️ this report:
https://travis-ci.org/yui/shifter/jobs/2847225

from istanbul.

gotwarlost avatar gotwarlost commented on June 9, 2024

Nice!

BTW, v0.1.8 also has the absolute path fix where it won't print the full directory name if there is only one file being covered. You should already have it if you are using the latest.

from istanbul.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.