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 report from nyc report using nyc@14 #1211

Closed
1 task
gms1 opened this issue Oct 22, 2019 · 5 comments
Closed
1 task

no report from nyc report using nyc@14 #1211

gms1 opened this issue Oct 22, 2019 · 5 comments

Comments

@gms1
Copy link

gms1 commented Oct 22, 2019

Link to bug demonstration repository

https://github.com/gms1/node-async-context
https://github.com/gms1/node-sqlite3-orm

NOTE: currently these repos are using nyc@13.3

nyc report works using nyc@13.3

gms@orion:~/work/HOT/node-async-context (master)$ npm run coverage:run

> asyncctx@2.0.8 coverage:run /home/gms/work/HOT/node-async-context
> nyc -e .ts -x "**/*.spec.ts" -x "src/asyncctx/spec/**/*" jasmine-ts

Randomized with seed 24788
Started
...............


15 specs, 0 failures
Finished in 0.464 seconds
Randomized with seed 24788 (jasmine --random=true --seed=24788)
-----------------------------|----------|----------|----------|----------|-------------------|
File                         |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
-----------------------------|----------|----------|----------|----------|-------------------|
All files                    |      100 |       50 |      100 |      100 |                   |
 ContinuationLocalStorage.ts |      100 |       50 |      100 |      100 |           141,172 |
-----------------------------|----------|----------|----------|----------|-------------------|
gms@orion:~/work/HOT/node-async-context (master)$ npx nyc report --reporter=text-lcov
TN:
SF:/home/gms/work/HOT/node-async-context/src/asyncctx/ContinuationLocalStorage.ts
FN:56,(anonymous_0)
FN:271,(anonymous_1)
FN:59,(anonymous_2)
...
a.s.o

but fails to report anything using nyc@14.1.1

gms@orion:~/work/HOT/node-async-context (master)$ npm install nyc@latest
npm WARN jasmine-ts@0.3.0 requires a peer of ts-node@>=3.2.0 <8 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.1 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/live-server/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ nyc@14.1.1
added 31 packages from 8 contributors, removed 98 packages, updated 14 packages and moved 19 packages in 16.662s
gms@orion:~/work/HOT/node-async-context (master *)$ npm run coverage:run

> asyncctx@2.0.8 coverage:run /home/gms/work/HOT/node-async-context
> nyc -e .ts -x "**/*.spec.ts" -x "src/asyncctx/spec/**/*" jasmine-ts

Randomized with seed 63702
Started
...............


15 specs, 0 failures
Finished in 0.469 seconds
Randomized with seed 63702 (jasmine --random=true --seed=63702)
-----------------------------|----------|----------|----------|----------|-------------------|
File                         |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
-----------------------------|----------|----------|----------|----------|-------------------|
All files                    |      100 |       84 |      100 |      100 |                   |
 ContinuationLocalStorage.ts |      100 |       84 |      100 |      100 |     93,95,141,172 |
-----------------------------|----------|----------|----------|----------|-------------------|
gms@orion:~/work/HOT/node-async-context (master *)$ npx nyc report --reporter=text-lcov
gms@orion:~/work/HOT/node-async-context (master *)$

Expected Behavior

nyc report should probably work with nyc@14.1.1 too

Observed Behavior

nyc report does not work with nyc@14.1.1

Troubleshooting steps

  • still occurring when I put cache: false in my nyc config

Environment Information

gms@orion:~/work/HOT/node-async-context (master)$ npx envinfo@latest --preset nyc
npx: Installierte 1 in 0.92s

  System:
    OS: Linux 5.0 Ubuntu 19.04 (Disco Dingo)
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    Memory: 2.09 GB / 15.37 GB
  Binaries:
    Node: 12.10.0 - /usr/bin/node
    npm: 6.11.3 - ~/.npm/bin/npm
  npmPackages:
    nyc: ^13.3.0 => 13.3.0 
    ts-node: ^8.4.1 => 8.4.1 
    typescript: ^3.6.4 => 3.6.4 
    typescript-example:  1.0.0 
gms1 added a commit to gms1/jsonpointerx that referenced this issue Oct 22, 2019
@coreyfarrell
Copy link
Member

I'm confused, what you've pasted shows that it is reporting. I believe nyc@14 does capture coverage that was missed by nyc 13 so that may be why you are seeing additional branches not covered (because nyc 13 failed to recognize those branches).

@gms1
Copy link
Author

gms1 commented Oct 23, 2019

Hi,

please note the following difference:

nyc@13.3:

...
gms@orion:~/work/HOT/node-async-context (master)$ npx nyc report --reporter=text-lcov
TN:
SF:/home/gms/work/HOT/node-async-context/src/asyncctx/ContinuationLocalStorage.ts
FN:56,(anonymous_0)
FN:271,(anonymous_1)
FN:59,(anonymous_2)
...
a.s.o

nyc@14.1.1:

...
gms@orion:~/work/HOT/node-async-context (master *)$ npx nyc report --reporter=text-lcov
gms@orion:~/work/HOT/node-async-context (master *)$

strange that this happens with all my repos using Jasmine-TS, but not with the repo using Mocha / TS-Node. But nyc report should work independently of the test runner, should it?
Another observation: if I capture the coverage with nyc@14; then after installing nyc@13 without capturing coverage again, I am getting the result from nyc report

@gms1
Copy link
Author

gms1 commented Oct 24, 2019

this issue does not occur using nyc@15.0.0-beta.0 ( #1104 )

@coreyfarrell
Copy link
Member

Ah the issue is that you have -e .ts when you execute but not when you ran reports in a separate command. nyc@14 runs the include/exclude processing when generating reports and unfortunately did not include the extension .ts by default. This means that for nyc 14 you would need npx nyc report -e .ts --reporter=text-lcov. nyc 15 will fix this by adding .ts to the default extension list.

@gms1
Copy link
Author

gms1 commented Feb 22, 2020

works in nyc 15

@gms1 gms1 closed this as completed Feb 22, 2020
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