Skip to content

Code coverage with Istanbul #2

Closed
@blakeembrey

Description

@blakeembrey
Member

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

self-assigned this
on Jul 15, 2015
blakeembrey

blakeembrey commented on Mar 13, 2016

@blakeembrey
MemberAuthor

Istanbul 1.0 alpha.

silviogutierrez

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

silviogutierrez

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.

sinedied

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.

jonaskello

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.

sinedied

sinedied commented on Mar 27, 2017

@sinedied

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

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

      Participants

      @silviogutierrez@sinedied@jonaskello@blakeembrey

      Issue actions

        Code coverage with Istanbul · Issue #2 · TypeStrong/ts-node