Skip to content

Code coverage with Istanbul #2

Description

@blakeembrey

I spent a long time trying to resolve this already, but can't find a decent solution. I started based on https://github.com/babel/babel/blob/master/packages/babel/src/api/register/node.js with process.env.running_under_istanbul and got it executing but got stuck with no coverage information coming out.

Activity

  1. self-assigned this
    on Jul 15, 2015
  2. blakeembrey commented on Mar 13, 2016

    @blakeembrey
    MemberAuthor

    Istanbul 1.0 alpha.

  3. silviogutierrez commented on Jun 2, 2016

    @silviogutierrez

    So I'm trying the alpha as you suggested, but I still get no info coming out. Here's the command:

    ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --compilers ts:ts-node/register client/test.ts

    Test passes fine, but it prints:

    No coverage information was collected, exit without writing coverage information at the bottom.

    Am I missing something? I'm on istanbul 1.0 alpha 2.

    Thanks,

    Silvio

  4. silviogutierrez commented on Jun 2, 2016

    @silviogutierrez

    Think I solved it! For the curious, you need an .istanbul.yml file. Mine is currently:

    instrumentation:
      extensions:
        - .tsx
        - .ts
    

    And it seemed to work.

  5. sinedied commented on Mar 22, 2017

    @sinedied

    I still can't make it work with istanbul@1.1.0-alpha.1 and jasmine: sourcemaps are broken for the jasmine reporters and something crash after the test executions :(

    Without istanbul the tests run fin with jasmine.

  6. jonaskello commented on Mar 25, 2017

    @jonaskello
    Contributor

    I found this comment very helpful. Basically use nyc command to run instanbul instead of the istanbul command and it works.

  7. sinedied commented on Mar 27, 2017

    @sinedied

    @jonaskello that's what I end up using, nyc works fine with ts-node without any pain.

  8. added a commit that references this issue on Jun 17, 2018
    59bbad5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

you can do thisGood candidate for a pull request.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions