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

Added option to ignore bad json files when reading the jsondir #13

Merged
merged 4 commits into from
Sep 8, 2016

Conversation

thyagab
Copy link
Contributor

@thyagab thyagab commented Sep 6, 2016

Added an option to ignore any bad json files to merge. This will help to ignore any empty json files getting created by protractor process for feature files with no scenarios to execute.

var options = {
theme: 'bootstrap',
jsonFile: 'test/report/cucumber_report.json',
output: 'test/report/cucumber_report.html',
reportSuiteAsScenarios: true,
launchReport: true,
ignoreBadJsonFile:true
};

@@ -22,9 +22,12 @@ var collectJSONS = function(options) {
jsonOutput.push(json);
}

if (!cucumberJson || typeof cucumberJson[0] === 'undefined') {
if (!cucumberJson || typeof cucumberJson[0] === 'undefined' && !options.ignoreBadJsonFile) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add parenthesis to the both if & else conditions?

if ((!cucumberJson || typeof cucumberJson[0] === 'undefined') && !options.ignoreBadJsonFile) 

Because it will throw Error even if options.ignoreBadJsonFile = false but if cucumberJson isn't valid object.

@gkushang
Copy link
Owner

gkushang commented Sep 7, 2016

Looks good apart from minor comment. I will merge this once it's resolved. Thanks @thyagab for adding the option!

@thyagab
Copy link
Contributor Author

thyagab commented Sep 7, 2016

@gkushang thank you for accepting the PR and for review comments. fixed and checked in.

@gkushang gkushang merged commit e6d2786 into gkushang:develop Sep 8, 2016
@gkushang
Copy link
Owner

gkushang commented Sep 8, 2016

@thyagab published the change as v0.2.9

@thyagab
Copy link
Contributor Author

thyagab commented Sep 8, 2016

Thank you @gkushang

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

Successfully merging this pull request may close these issues.

2 participants