Closed j2ro closed 9 years ago
Are you console.log
ing an array or something in your step definitions? If so, try to remove it.
I am having the same issue, and I do no console.logs within my step defs.
Do you happen to use cucumber Background
steps?
Nope, I'm just running two scenarios in one feature at the moment.
I see.
Can you open the module in your node_modules/grunt-cucumberjs/tasks/cucumber.js
go to line 101:
try {
featureJsonOutput = JSON.parse(featureOutput);
}
And try to log featureOutput
, there is a problem with parsing the output as Json and I need to see what the reason is.
Thanks.
I am not using console.log in my step definitions, but my applications are logging to stdout (using Winston).
When I log featureOutput, sometimes I see the console output included after the JSON report section, hence why the JSON parsing fails. However, this is intermittent. Sometimes it works and sometimes not (it depends if the console was written to whilst the JSON report was being generated).
In both your cases I would need to see a failing example.
The issue we have is that we spawn cucumber as a command, which dumps the report along with everything else into console. Extracting that can be difficult.
I've raised this issue with them, let's see what they come back with.
Looks like they've had this PR open for a bit https://github.com/cucumber/cucumber-js/pull/188
OK....
I might know what the problem is....
So the same issue happened to me, and after digging for a couple of hours I realised that this step doesn't work
And all "updatedTime" properties should be in the last "1" hour
Cucumber skips it! Further more no json output is produced
but changing it to this work!
And I see all "updatedTime" properties should be in the last "1" hour
I would recommend deleting all but one of your feature files, running the task and see if it works. Then add the other feature files and see if you have a similar issue.
Meanwhile I will raise an issue with them
this should be fixed with latest cucumber
I am getting the following error intermittently when running my cucumber tests, and producing a HTML report via grunt-cucumberjs:
"Unable to parse cucumberjs output into json."
It looks like that this is thrown on line 88 of cucumber.js.
I think this is happening because when my cucumber test suite finishes, it runs an After block, which in turn writes to sysout. This output in turn is then getting appended to the end of the JSON output, and thus is no longer valid JSON.