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 information has been collected #85

Open
YasinY opened this issue Jul 8, 2021 · 29 comments
Open

No coverage information has been collected #85

YasinY opened this issue Jul 8, 2021 · 29 comments

Comments

@YasinY
Copy link

YasinY commented Jul 8, 2021

"No coverage information has been collected" despite server tests passing as well as client tests passing when opening the browser, when going on localhost:3000/coverage.

i followed the guide thoroughly, adding all required packages, defining the babel env in package.json as well as setting up the proper run scripts.

Your Environment

  • Version used: latest
  • Environment name and version (e.g. Node 0.10.47): MeteorJS 2.0
  • Operating System and version: MacOS Catalina 10.15
@YasinY
Copy link
Author

YasinY commented Jul 8, 2021

edit:
Error: Failed to save html report
at packages/meteortesting:mocha/server.handleCoverage.js:37:18
at runWithEnvironment (packages/meteor.js:1286:24)

is the error. will look into it.

@serut
Copy link
Owner

serut commented Jul 14, 2021

I don't think meteor-coverage is still working, as I can see the test from the package are not working anymore :

$  meteor npm install
...
$  meteor npm test
...
20210714-13:57:16.986(2)? Creating a new folder /Users/lmieulet/meteor-workspace/meteor-coverage/someapp/.coverage/.remap
W20210714-13:57:17.429(2)? (STDERR) events.js:352
W20210714-13:57:17.430(2)? (STDERR)       throw er; // Unhandled 'error' event
W20210714-13:57:17.430(2)? (STDERR)       ^
W20210714-13:57:17.430(2)? (STDERR) 
W20210714-13:57:17.431(2)? (STDERR) Error [ERR_STREAM_WRITE_AFTER_END] [ERR_STREAM_WRITE_AFTER_END]: write after end
W20210714-13:57:17.431(2)? (STDERR)     at writeAfterEnd (_http_outgoing.js:694:15)
W20210714-13:57:17.431(2)? (STDERR)     at ServerResponse.end (_http_outgoing.js:815:7)
W20210714-13:57:17.431(2)? (STDERR)     at Object.generate (/private/var/folders/0f/j84qkclx6rs160p6yr3d5g8h0000gn/T/meteor-test-run1p922p0.dy2h/.meteor/local/build/programs/server/packages/lmieulet_meteor-coverage.js:1:118215)
W20210714-13:57:17.432(2)? (STDERR)     at Object.generateReport (/private/var/folders/0f/j84qkclx6rs160p6yr3d5g8h0000gn/T/meteor-test-run1p922p0.dy2h/.meteor/local/build/programs/server/packages/lmieulet_meteor-coverage.js:1:121363)
W20210714-13:57:17.432(2)? (STDERR)     at Object.exportFile (/private/var/folders/0f/j84qkclx6rs160p6yr3d5g8h0000gn/T/meteor-test-run1p922p0.dy2h/.meteor/local/build/programs/server/packages/lmieulet_meteor-coverage.js:1:89073)
W20210714-13:57:17.432(2)? (STDERR)     at /private/var/folders/0f/j84qkclx6rs160p6yr3d5g8h0000gn/T/meteor-test-run1p922p0.dy2h/.meteor/local/build/programs/server/packages/lmieulet_meteor-coverage.js:1:93514
W20210714-13:57:17.432(2)? (STDERR)     at /private/var/folders/0f/j84qkclx6rs160p6yr3d5g8h0000gn/T/meteor-test-run1p922p0.dy2h/.meteor/local/build/programs/server/packages/lmieulet_meteor-coverage.js:1:92529
W20210714-13:57:17.432(2)? (STDERR)     at /Users/lmieulet/.meteor/packages/promise/.0.12.0.qsgjpe.bwik++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/meteor-promise/fiber_pool.js:43:40
W20210714-13:57:17.433(2)? (STDERR) Emitted 'error' event on ServerResponse instance at:
W20210714-13:57:17.433(2)? (STDERR)     at writeAfterEndNT (_http_outgoing.js:753:7)
W20210714-13:57:17.433(2)? (STDERR)     at processTicksAndRejections (internal/process/task_queues.js:83:21) {
W20210714-13:57:17.433(2)? (STDERR)   code: 'ERR_STREAM_WRITE_AFTER_END'
W20210714-13:57:17.434(2)? (STDERR) }

Coverage folder has been created but no line coverage is visible.

@bessw
Copy link

bessw commented Aug 24, 2021

I'm getting a dependency version conflict with meteortesting:[email protected] and lmieulet:[email protected] because version 4.0.0 isn't mentioned in meteortesting:mocha's dependencies:
api.use('lmieulet:[email protected] || 2.0.1 || 3.0.0', 'client', { weak: true });

This seems to force meteortesting:mocha to downgrade to version 0.5.1, because it's the last version without an dependency on lmieulet:meteor-coverage

I already created an issue: Meteor-Community-Packages/meteor-mocha#121

@jankapunkt
Copy link
Collaborator

I create a PR in a few minutes, until it's published you can hotfix this in your .meteor/packages by using

@jankapunkt
Copy link
Collaborator

It seems to not fix the situation, I cloned and updated meteortesting:mocha with the following line:

api.use('lmieulet:[email protected] || 2.0.1 || 3.0.0 || 4.0.0', 'client', { weak: true });

and it now runs through but the generated coverage contains only empty lines!

@jankapunkt
Copy link
Collaborator

Downgrading to lmieulet:[email protected] @serut do you know which changes could be the cause here?

@serut
Copy link
Owner

serut commented Aug 24, 2021

It would be cool if that fixes meteor-coverage tests

@jankapunkt
Copy link
Collaborator

@serut from my end it works with meteortesting:[email protected] and lmieulet:[email protected] I just wonder why coverage is empty when using 4.0.0 :-/ I also saw that circle tests fail for the latest PR

@serut
Copy link
Owner

serut commented Aug 24, 2021

I assume lmieulet:[email protected] uses Meteor 1.8, whereas 4.0.0 uses the latest one.
So it can be related to the update of node

@jankapunkt
Copy link
Collaborator

Hm but how can this change lead to empty coverage? Isn't it relying on Istanbul?

@bessw
Copy link

bessw commented Aug 24, 2021

Im not sure which plugin versions were selected, but with meteor 2.3.4 I'm getting this error in my CI:

/<username>/.meteor/packages/meteortesting_mocha-core/.8.1.2.7kamy4.2ci9x++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/mocha/lib/runner.js:906
throw err;
     ^
 
 Error [ERR_STREAM_WRITE_AFTER_END] [ERR_STREAM_WRITE_AFTER_END]: write after end
     at writeAfterEnd (_http_outgoing.js:694:15)
     at ServerResponse.end (_http_outgoing.js:815:7)
     at Object.generate (packages/lmieulet:meteor-coverage/server/report/report-remap.js:59:14)
     at Object.generateReport (packages/lmieulet:meteor-coverage/server/report/report-service.js:28:21)
     at Object.exportFile (packages/lmieulet:meteor-coverage/server/handlers.js:75:19)
     at packages/lmieulet:meteor-coverage/server/router.js:53:16
     at packages/lmieulet:meteor-coverage/server/router.js:26:19
     at /<username>/.meteor/packages/promise/.0.12.0.tdh9wz.ki37p++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/meteor-promise/fiber_pool.js:43:40
 Emitted 'error' event on ServerResponse instance at:
     at writeAfterEndNT (_http_outgoing.js:753:7)
     at processTicksAndRejections (internal/process/task_queues.js:83:21) {
   code: 'ERR_STREAM_WRITE_AFTER_END'
 }

@serut
Copy link
Owner

serut commented Aug 24, 2021

Hm but how can this change lead to empty coverage? Isn't it relying on Istanbul?

Yes most of the job is packaged with babel / istanbul. But the remap with the sourcemap is done manually, maybe the interface changed with a newest version of node. Not sure yet

Yeap, same error than tests on circle ci
https://app.circleci.com/pipelines/github/serut/meteor-coverage/2/workflows/f60aec25-80af-4ff0-843e-8a3572baeba8/jobs/164

@bessw
Copy link

bessw commented Sep 23, 2021

Meteor v2.3 updates node from 12.22.1 to 14.17.1

From the node release notes https://nodejs.org/en/blog/release/v14.0.0/ :

  • [c776a37791] - (SEMVER-MAJOR) http: end with data can cause write after end (Robert Nagy) #28666

From #28666:

Calling end() with data while ending should trigger a write after end error.

ERR_STREAM_WRITE_AFTER_END is related to that change.

Could it be that this causes the problems?

@bessw
Copy link

bessw commented Oct 2, 2021

There is a duplicate call to this.res.end('{"type":"success"}');
First in

this.res.end('{"type":"success"}');

and later in

this.res.end('{"type":"success"}');

I think the second one is redundant, removing this line should fix the error from above, but I can't test it right now.

@serut
Copy link
Owner

serut commented Oct 4, 2021

It looks way better without this second call :

this.res.end('{"type":"success"}');

I've published lmieulet:[email protected], can you try it?

The HTML report does not look functionnal, but text report OK. Let's see if the circle.ci of this package is fine too.

@bessw
Copy link

bessw commented Oct 15, 2021

Thanks this fixed my CI jobs with code coverage.

HTML reports are also functional.

@jankapunkt
Copy link
Collaborator

jankapunkt commented Nov 1, 2021

I still get no coverage, it's all empty (although the files are listed).

I am using 4.1.0 and I get the following messages:

W20211101-13:03:51.286(1)? (STDERR) Handlebars: Access has been denied to resolve the property "statements" because it is not an "own property" of its parent.
W20211101-13:03:51.286(1)? (STDERR) You can add a runtime option to disable the check or this warning:
W20211101-13:03:51.286(1)? (STDERR) See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details

the other packages are

meteortesting:[email protected]
meteortesting:[email protected]
meteortesting:[email protected]

Any ideas?

@jankapunkt
Copy link
Collaborator

interesting: text summary and json summary do work fine with the above mentioned setup

@serut
Copy link
Owner

serut commented Nov 4, 2021

Ok so you don't have lcov and or html coverage report ? May I ask you a reproductible env ?

@jankapunkt
Copy link
Collaborator

@jankapunkt
Copy link
Collaborator

@serut had no time before but the link contains a repro, although this one is even different, no coverage created at all. However, it's Meteor 2.5 and uses meteortesting:[email protected] and lmieulet:[email protected]

@jankapunkt
Copy link
Collaborator

@serut any update on this?

@serut
Copy link
Owner

serut commented Nov 24, 2021

No time yet to work on this

@jankapunkt
Copy link
Collaborator

It can be broken down to the line onSummary in the html report class this is where the errors are generated.

https://github.com/serut/meteor-coverage/blob/master/server/report/report-html.js#L63

@jankapunkt
Copy link
Collaborator

Downgrading to 3.2.0 fixes the issue

@bessw
Copy link

bessw commented Dec 8, 2021

it works with

lmieulet:meteor-legacy-coverage is required because im using Typescript, but maybe it's also the reason why coverage is working in my setup.

@djlogan2
Copy link

djlogan2 commented Feb 7, 2022

I am also experiencing this problem. I was unable to resolve this by downgrading to 3.2.0 either.

@dreich-nucleus
Copy link

I am also unable to see any test results. I am testing a newly generated app and package in Meteor 2.6. The versions are the same as bessw lists above. When I run once (like for a CI), OUT_HTML and OUT_JSON both show the "Failed to save XYZ" message. OUT_TEXT "works" because there is no error, but there is no report either.

@ShubhamKapoorGlider
Copy link

Meteor version -> [email protected]
meteortesting:[email protected]
lmieulet:[email protected]

this works for me

@jankapunkt jankapunkt mentioned this issue Aug 1, 2024
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants