Closed nploi closed 2 years ago
Which cucumber are you using to generate your report? cucumber-js? cucumber-ruby? cucumber-jvm? Something else?
Could try to generate the json report with your cucumber in addition of the ndjson one? If so, does it work?
For information: we have decided to not deprecate the legacy json reporter anymore, but keeping it in maintenance mode: thus it won't be removed from the cucumber implementations, but it won't be enhanced anymore.
Which cucumber are you using to generate your report? cucumber-js? cucumber-ruby? cucumber-jvm? Something else?
He said cucumber-js 7.3.1
@nploi have you considered using the built-in json
formatter directly?
Which cucumber are you using to generate your report? cucumber-js? cucumber-ruby? cucumber-jvm? Something else?
He said cucumber-js 7.3.1
Oh, yes, missed it. Sorry for that 😅
@nploi have you considered using the built-in
json
formatter directly?
That is what I suggested, yes, but you explained it simpler 😁
hello @aurelien-reeves, @aslakhellesoy,
Which cucumber are you using to generate your report? cucumber-js? cucumber-ruby? cucumber-jvm? Something else?
He said cucumber-js 7.3.1
@nploi have you considered using the built-in
json
formatter directly?
I used it before switching to the message
formatter.
when i use json
formatter of cucumber-js, sometimes it get error like below
/my-project/node_modules/@cucumber/cucumber/src/formatter/json_formatter.ts:180
|[0m this.log(JSON.stringify(features, null, 2))
|[0m ^
|[0m RangeError: Invalid string length
|[0m at JSON.stringify (<anonymous>)
|[0m at JsonFormatter.onTestRunFinished (/my-project/node_modules/@cucumber/cucumber/src/formatter/json_formatter.ts:180:19)
|[0m at EventEmitter.<anonymous> (/my-project/node_modules/@cucumber/cucumber/src/formatter/json_formatter.ts:89:14)
|[0m at EventEmitter.emit (events.js:412:35)
|[0m at EventEmitter.emit (domain.js:470:12)
|[0m at Coordinator.onWorkerProcessClose (/my-project/node_modules/@cucumber/cucumber/src/runtime/parallel/coordinator.ts:155:29)
|[0m at ChildProcess.<anonymous> (/my-project/node_modules/@cucumber/cucumber/src/runtime/parallel/coordinator.ts:117:12)
|[0m at ChildProcess.emit (events.js:400:28)
|[0m at ChildProcess.emit (domain.js:470:12)
|[0m at maybeClose (internal/child_process.js:1055:16)
|[0m at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
|[0m error Command failed with exit code 1.
I used it before switching to the
message
formatter. when i usejson
formatter of cucumber-js, sometimes it get error like below
Sometimes or always? If sometimes, with the same features everytime? Are you able to try identify the feature which seems to be responsible for that?
Sometimes or always? If sometimes, with the same features everytime? Are you able to try identify the feature which seems to be responsible for that?
Hi @aurelien-reeves
@nploi is my teammate :)) we have used JSON fomatter before and get your suggestion to migration to message formatter
Not always It only happen for larger file
I used it before switching to the
message
formatter. when i usejson
formatter of cucumber-js, sometimes it get error like belowSometimes or always? If sometimes, with the same features everytime? Are you able to try identify the feature which seems to be responsible for that?
JSON.stringify
large object.Do you have some attachments?
Do you have some attachments?
yes, i have, i attach texts and images every step.
Hi @aurelien-reeves
@nploi is my teammate :)) we have used JSON fomatter before and get your suggestion to migration to
message formatter
Not always It only happen for larger file
Hi @vctqs1 :)
Ok, thanks for the tip.
I must say I am a little bit confused with your project :p
The message
formatter to generate ndjson
files is great when you want to integrate your own tooling.
There is no point into re-generating a json file with the cucumber-json-formatter standalone tool. If you still need a json
file alongside the ndjson
one for some reason, you can use both directly as output from cucumber (if I am not wrong 🤔)
Could you tell us more about what you are trying to achieve? What is your actual need?
1. Sometimes 2. Yes, the same features everytime. 3. i can't identify the feature, but i guess it happen when try `JSON.stringify` large object.
yes, i have, i attach texts and images every step.
It looks like your are reaching the limits of what is possible with your reports A report of 512MB is actually increasingly huge! Your errors may be related to memory limit being reached.
For example: https://stackoverflow.com/questions/29175877/json-stringify-throws-rangeerror-invalid-string-length-for-huge-objects which leads to this issue: https://github.com/nodejs/node-v0.x-archive/issues/14170
It seems you are building an intensive tool which reach the limits of what will be possible to do with cucumber json format itself. I would suggest to:
ndjson
reportsThe key here is to use streams. This is how works the ndjson
formatter: it streams the data. And as you can see, it seems to work properly in your case. So you could create your own custom formatter which would stream directly into your custom report format, or rely on existing ndjson
but using streams too to read it rather than processing it at once.
Hi @aurelien-reeves,
Could you tell us more about what you are trying to achieve? What is your actual need?
We need the json file for generate static html from other library.
It looks like your are reaching the limits of what is possible with your reports A report of 512MB is actually increasingly huge! Your errors may be related to memory limit being reached.
For example: https://stackoverflow.com/questions/29175877/json-stringify-throws-rangeerror-invalid-string-length-for-huge-objects which leads to this issue: nodejs/node-v0.x-archive#14170
For now, I will split the test suite, it will generate small files.
Thanks for your suggestion.
Ok, thanks for your reply
For now I consider it won't be fixed. But if other users encounter that issue, feel free to re-open it
We need the json file for generate static html from other library.
Might be worth updating that library to support the ndjson format and process the report as a stream.
Might be worth updating that library to support the ndjson format and process the report as a stream.
Look good to me!. Maybe, i will contribute that library. 👍
I encounter the same issue when I use JSON format, especially with larger reports, such as 500MB in size.
/app/node_modules/@cucumber/cucumber/src/formatter/json_formatter.ts:185
this.log(JSON.stringify(features, null, 2))
^
RangeError: Invalid string length
at JSON.stringify (
Describe the bug Convert
message
toJson
error when string too big.To Reproduce Steps to reproduce the behavior:
cucumber-report.ndjson
after run test. file size > 512MBcat report/message/cucumber-report.ndjson | cucumber-json-formatter --format ndjson > report/json/cucumber-report.json
Expected behavior Convert
message
tojson
is OK.Your Environment