Skip to content

Commit

Permalink
code refactoring and merge issues fix
Browse files Browse the repository at this point in the history
  • Loading branch information
harshit-bs committed Jun 5, 2023
1 parent ae9d2dc commit c967de8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 66 deletions.
10 changes: 5 additions & 5 deletions cucumber-js/nightwatch-format.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs');
const path = require('path');
const Utils = require('../lib/utils');
const {Logger} = Utils;
const {Logger, createFolder} = Utils;
const {Formatter} = require('@cucumber/cucumber');

const NightwatchState = require('./nightwatchState');
Expand Down Expand Up @@ -108,7 +108,7 @@ module.exports = class MessageFormatter extends Formatter {
}

writeReportFile(filename, rendered, shouldCreateFolder, output_folder) {
(shouldCreateFolder ? Utils.createFolder(output_folder) : Promise.resolve())
(shouldCreateFolder ? createFolder(output_folder) : Promise.resolve())
.then(() => {
return new Promise((resolve, reject) => {
fs.writeFile(filename, rendered, function(err) {
Expand Down Expand Up @@ -172,9 +172,9 @@ module.exports = class MessageFormatter extends Formatter {
testStepStarted: this.testStepStartedData
};

const key = Object.keys(envelope)[0];
if (handlers[key]) {
handlers[key].call(this, envelope[key]);
const cucumberEvent = Object.keys(envelope)[0];
if (cucumberEvent && handlers[cucumberEvent]) {
handlers[cucumberEvent].call(this, envelope[cucumberEvent]);
}
}
};
41 changes: 0 additions & 41 deletions lib/runner/eventHandler.js

This file was deleted.

4 changes: 0 additions & 4 deletions lib/transport/selenium-webdriver/httpclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ module.exports = function(settings, HttpResponse) {

const request = new HttpRequest(this.options);

if (settings.eventHub) {
request.eventHub = settings.eventHub;
}

return new Promise((resolve, reject) => {
request.once('success', (data, response, isRedirect) => {
const {statusCode, headers} = response;
Expand Down
19 changes: 3 additions & 16 deletions lib/utils/logger/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function timestamp(d = new Date(), format) {
return d.toISOString();
}

let time = [
const time = [
pad(d.getHours()),
pad(d.getMinutes()),
pad(d.getSeconds())
Expand Down Expand Up @@ -76,8 +76,8 @@ function logMessage(type, message, args, alwaysShow) {
let messageStr = '';
let logMethod = 'log';
let prefix;
let d = new Date();
let timeIso = d.toISOString();
const d = new Date();
const timeIso = d.toISOString();
let timestamp = logTimestamp(d);

switch (type) {
Expand Down Expand Up @@ -472,19 +472,6 @@ module.exports.collectOutput = function() {
return output;
};

module.exports.collectCommandOutput = function() {
const instance = Logger.getInstance();

if (!instance) {
return [];
}

const {commandOutput} = instance;
instance.commandOutput = [];

return commandOutput;
};

module.exports.collectTestSectionOutput = function() {
const instance = Logger.getInstance();

Expand Down

0 comments on commit c967de8

Please sign in to comment.