Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No coverage being generated in 14.1.0 #1102

Closed
2 tasks done
Codex- opened this issue May 6, 2019 · 6 comments
Closed
2 tasks done

No coverage being generated in 14.1.0 #1102

Codex- opened this issue May 6, 2019 · 6 comments

Comments

@Codex-
Copy link

Codex- commented May 6, 2019

The suggestion here does not resolve this issue, this is not running via ts-node or any other typescript only method of running. In this very basic configuration it's simply running mocha over the generated *.js files.

Also found no resolution attempting to use various configuration attempted in #1090

Link to bug demonstration repository

https://github.com/Codex-/nyc-bug

Steps to run

  1. npm i
  2. npm run build
  3. npm run test

Test simply executes: nyc --reporter=lcov --reporter=html mocha where mocha is configured to only run *.test.js files.

Expected Behavior

lcov.info to be populated as 13.3.0 does:
13.3.0 lcov.info:

TN:
SF:C:\Dev\p\nyc-bug\src\index.ts
FN:1,testFunc
FNF:1
FNH:1
FNDA:1,testFunc
DA:1,1
DA:2,1
LF:2
LH:2
BRF:0
BRH:0
end_of_record

Observed Behavior

14.1.0 lcov.info:
Empty

This occurs with or without the suggested modification to the config --extension='.ts'.

Troubleshooting steps

  • still occurring when I put cache: false in my nyc config
  • works correctly when reverting to 13.*

Environment Information

Tested in Linux & Windows

  System:
    OS: Linux 4.14 Manjaro Linux
    CPU: (2) x64 Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
    Memory: 147.55 MB / 1.95 GB
  Binaries:
    Node: 8.11.1 - ~/.nvm/versions/node/v8.11.1/bin/node
    npm: 5.6.0 - ~/.nvm/versions/node/v8.11.1/bin/npm
  npmPackages:
    nyc: ^14.1.0 => 14.1.0 
    typescript: ^3.4.5 => 3.4.5 
  System:
    OS: Windows 10
    CPU: (4) x64 Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
    Memory: 18.15 GB / 31.87 GB
  Binaries:
    Node: 8.12.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.15.2 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    nyc: ^14.1.0 => 14.1.0
    typescript: ^3.4.5 => 3.4.5

Cheers.

@coreyfarrell
Copy link
Member

I just tested your demo repository with nyc --extension=.ts --reporter=lcov --reporter=html mocha for your test script, it worked perfectly.

@Codex-
Copy link
Author

Codex- commented May 6, 2019

Ah I see, didn't like my Linux config for some reason. Works on Windows.

Why does this require the extra configuration now when performing mocha tests on generated *.js? Am I missing something in the changelog regarding breaking changes?

@coreyfarrell
Copy link
Member

nyc looks at the source-maps to determine what source produced generated files. This is --exclude-after-remap, coverage is remapped to the original source filename and then include/exclude/extension matching reprocessed. The purpose of this change is to support testing bundles.

Before a minute ago the changelog only mentioned that include and exclude were reprocessed. I just updated it to also say extension.

The plan is that nyc@15 will enable --extension=.ts by default but this is a potentially breaking change so it can't happen to nyc@14.

@Codex-
Copy link
Author

Codex- commented May 6, 2019

Great, thanks for updating that. Will wait til 15.* to upgrade our packages.

With remaining on 13.x is it possible to have the packages bumped to resolve the npm audit warning?

  High            Prototype Pollution                                           
  Package         handlebars                                                    
  Dependency of   nyc [dev]                                                     
  Path            nyc > istanbul-reports > handlebars                           
  More info       https://nodesecurity.io/advisories/755 

@coreyfarrell
Copy link
Member

Part of the problem with nyc@13 is that it bundled all dependencies, one of the major changes to nyc@14 is that we no longer bundle dependencies which solves this npm audit thing. It's worth noting that this is a false vulnerability report, handlebars is only vulnerable to untrusted templates and istanbul-reports doesn't use any outside templates. It was also already fixed once by publishing a new version then it was determined that the first fix to handlebars was only a half fix, so the "vulnerability" was flagged again. Unfortunately I do not have time available to support previous versions (sorry).

Work towards nyc 15 is beginning, partly because I want to change the default extension list sooner than later. You can follow progress at #1104.

I'm closing this issue as I believe this was an issue of documentation (the changelog not being completely clear) and you've confirmed that your issue can be solved by updating the extension list as suggested.

@Codex-
Copy link
Author

Codex- commented May 7, 2019

Fair enough, cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants