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

Disable HTML reporter in Cucumber. #4025

Merged
merged 3 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/reporter/global-reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@ module.exports = class GlobalReporter {
this.suiteResults = [];
this.skippedSuites = 0;
this.uncaughtErr = null;
this.reporterFile = reporter;
this.reportFileName = reportFileName;

if (!Array.isArray(this.reporterFile) && typeof this.reporterFile == 'string') {
this.reporterFile = this.reporterFile.split(',');
this.reporterFile = [];
if (Array.isArray(reporter)) {
// Any subsequent changes in `this.reporterFile` shouldn't lead to changes in
// `argv.reporter` provided by the user, or `DefaultSettings.default_reporter`.
this.reporterFile = reporter.slice(0);
} else if (typeof reporter == 'string') {
this.reporterFile = reporter.split(',');
}
this.settings = settings;
this.summary = new Summary(settings);
Expand Down
20 changes: 20 additions & 0 deletions lib/runner/test-runners/cucumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const TestSuite = require('../../testsuite');
const {Logger, isString, isDefined} = require('../../utils');
const {NightwatchEventHub} = require('../eventHub.js');
const {getTestSourceForRerunFailed} = require('../rerunUtil.js');
const DefaultSettings = require('../../settings/defaults.js');

class CucumberSuite extends TestSuite {
static isSessionCreateError(err) {
Expand Down Expand Up @@ -252,6 +253,25 @@ class CucumberRunnner extends Runner {
return 'cucumber';
}

constructor(settings, argv, addtOpts) {
super(settings, argv, addtOpts);

// Disable HTML Reporter as it is not yet supported in Cucumber.
const reporterFile = this.globalReporter.reporterFile;
if (reporterFile && reporterFile.includes('html')) {
if (reporterFile.toString() !== DefaultSettings.default_reporter.toString()) {
// user has specifically asked for HTML report.
// eslint-disable-next-line no-console
console.warn(Logger.colors.yellow('HTML reporter is not supported with Cucumber runner.'));
}

const index = reporterFile.indexOf('html');
if (index > -1) {
reporterFile.splice(index, 1);
}
}
}

hasTestFailures(result) {
return result && result.success === false;
}
Expand Down
2 changes: 0 additions & 2 deletions lib/runner/test-runners/cucumber/_setup_cucumber_runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ Before(function({pickle, testCaseStartedId}) {
const webdriver = {};

process.env.CUCUMBER_TEST_CASE_STARTED_ID = testCaseStartedId;
// eslint-disable-next-line no-console
console.log('setup_cucumber_before', 'PID:', process.pid, 'testCaseStartedId:', testCaseStartedId);

if (this.parameters['webdriver-host']) {
webdriver.host = this.parameters['webdriver-host'];
Expand Down
Loading