alsatian-test/alsatian

Alsatian Test Coverage with NYC can not get test result

acgotaku opened this issue · 4 comments

This is my demo: https://github.com/acgotaku/alsatian-codecov

Run yarn check-coverage, output:

> alsatian src/**/*.spec.ts

  Pass: 3 / 3
  Fail: 0 / 3
  Ignore: 0 / 3
  
  
----------|----------|----------|----------|----------|-------------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files |        0 |        0 |        0 |        0 |                   |
----------|----------|----------|----------|----------|-------------------|

NYC can not output correct test result.
Could you help me find the problems from my demo?

Thanks very much!

I'll have a peek and update you when I find something :)

Hey @acgotaku,

I've submitted Pull Request -> acgotaku/alsatian-codecov#1 that resolves this simply, it's just the nyc config that's incorrect.

The nyc property you had in the below config is not needed and only required if your config is in the package.json

Current

{
  "nyc": {
    "extends": "@istanbuljs/nyc-config-typescript",
    "all": true,
    "check-coverage": true
  }
}

Corrected

{
  "extends": "@istanbuljs/nyc-config-typescript",
  "all": true,
  "check-coverage": true
}

Hello @jamesadarich Thank you very much!

Change the config file fix my problem!

@jamesadarich Maybe you can update the document. https://github.com/alsatian-test/alsatian/wiki/Check-Test-Coverage-with-NYC

Let user add test coverage more easy!