Open YasinY opened 3 years ago
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.
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.
I'm getting a dependency version conflict with meteortesting:mocha@2.0.2
and lmieulet:meteor-coverage@4.0.0
because version 4.0.0 isn't mentioned in meteortesting:mocha's dependencies:
api.use('lmieulet:meteor-coverage@1.1.4 || 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: https://github.com/Meteor-Community-Packages/meteor-mocha/issues/121
I create a PR in a few minutes, until it's published you can hotfix this in your .meteor/packages
by using
lmieulet:meteor-coverage@4.0.0!
It seems to not fix the situation, I cloned and updated meteortesting:mocha
with the following line:
api.use('lmieulet:meteor-coverage@1.1.4 || 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!
Downgrading to lmieulet:meteor-coverage@3.2.0
@serut do you know which changes could be the cause here?
It would be cool if that fixes meteor-coverage tests
@serut from my end it works with meteortesting:mocha@2.0.2
and lmieulet:meteor-coverage@3.2.0
I just wonder why coverage is empty when using 4.0.0 :-/ I also saw that circle tests fail for the latest PR
I assume lmieulet:meteor-coverage@3.2.0 uses Meteor 1.8, whereas 4.0.0 uses the latest one. So it can be related to the update of node
Hm but how can this change lead to empty coverage? Isn't it relying on Istanbul?
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'
}
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
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?
There is a duplicate call to this.res.end('{"type":"success"}');
First in https://github.com/serut/meteor-coverage/blob/da59c18331807069e49465e27b1c3e072159f467/server/report/report-generic.js#L33
I think the second one is redundant, removing this line should fix the error from above, but I can't test it right now.
It looks way better without this second call :
https://github.com/serut/meteor-coverage/blob/da59c18331807069e49465e27b1c3e072159f467/server/report/report-remap.js#L59
I've published lmieulet:meteor-coverage@4.1.0, 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.
Thanks this fixed my CI jobs with code coverage.
HTML reports are also functional.
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:browser-tests@1.3.4
meteortesting:mocha@2.0.3
meteortesting:mocha-core@8.1.2
Any ideas?
interesting: text summary and json summary do work fine with the above mentioned setup
Ok so you don't have lcov and or html coverage report ? May I ask you a reproductible env ?
@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:mocha@2.0.3
and lmieulet:meteor-coverage@4.1.0
@serut any update on this?
No time yet to work on this
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
Downgrading to 3.2.0 fixes the issue
it works with
typescript@4.3.5
meteortesting:mocha@2.0.3
lmieulet:meteor-coverage@4.1.0
lmieulet:meteor-legacy-coverage@0.1.0
lmieulet:meteor-legacy-coverage
is required because im using Typescript, but maybe it's also the reason why coverage is working in my setup.
I am also experiencing this problem. I was unable to resolve this by downgrading to 3.2.0 either.
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.
Meteor version -> METEOR@2.6.1 meteortesting:mocha@2.0.3 lmieulet:meteor-coverage@1.1.4
this works for me
"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