Skip to content

Commit ce5bb28

Browse files
author
DavertMik
committed
reverted change to ;
1 parent 9eeb4e9 commit ce5bb28

35 files changed

+392
-391
lines changed

lib/actor.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Actor {
4040
limitTime(timeout) {
4141
if (!store.timeouts) return this;
4242

43-
event.dispatcher.prependOnceListener(event.step.before, (step) => {
43+
event.dispatcher.prependOnceListener(event.step.before, step => {
4444
output.log(`Timeout to ${step}: ${timeout}s`);
4545
step.setTimeout(timeout * 1000, Step.TIMEOUT_ORDER.codeLimitTime);
4646
});
@@ -78,10 +78,10 @@ module.exports = function (obj = {}) {
7878
const helpers = container.helpers();
7979

8080
// add methods from enabled helpers
81-
Object.values(helpers).forEach((helper) => {
81+
Object.values(helpers).forEach(helper => {
8282
methodsOfObject(helper, 'Helper')
83-
.filter((method) => method !== 'constructor' && method[0] !== '_')
84-
.forEach((action) => {
83+
.filter(method => method !== 'constructor' && method[0] !== '_')
84+
.forEach(action => {
8585
const actionAlias = translation.actionAliasFor(action);
8686
if (!actor[action]) {
8787
actor[action] = actor[actionAlias] = function () {
@@ -98,7 +98,7 @@ module.exports = function (obj = {}) {
9898
});
9999

100100
// add translated custom steps from actor
101-
Object.keys(obj).forEach((key) => {
101+
Object.keys(obj).forEach(key => {
102102
const actionAlias = translation.actionAliasFor(key);
103103
if (!actor[actionAlias]) {
104104
actor[actionAlias] = actor[key];
@@ -113,7 +113,7 @@ module.exports = function (obj = {}) {
113113
});
114114
// store.actor = actor;
115115
// add custom steps from actor
116-
Object.keys(obj).forEach((key) => {
116+
Object.keys(obj).forEach(key => {
117117
const ms = new MetaStep('I', key);
118118
ms.setContext(actor);
119119
actor[key] = ms.run.bind(ms, obj[key]);
@@ -156,7 +156,7 @@ function recordStep(step, args) {
156156
event.emit(event.step.finished, step);
157157
});
158158

159-
recorder.catchWithoutStop((err) => {
159+
recorder.catchWithoutStop(err => {
160160
step.status = 'failed';
161161
step.endTime = Date.now();
162162
event.emit(event.step.failed, step);

lib/cli.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ class Cli extends Base {
3535
console.log();
3636
});
3737

38-
runner.on('suite', (suite) => {
38+
runner.on('suite', suite => {
3939
output.suite.started(suite);
4040
});
4141

42-
runner.on('fail', (test) => {
42+
runner.on('fail', test => {
4343
if (test.ctx.currentTest) {
4444
this.loadedTests.push(test.ctx.currentTest.uid);
4545
}
@@ -50,7 +50,7 @@ class Cli extends Base {
5050
output.test.failed(test);
5151
});
5252

53-
runner.on('pending', (test) => {
53+
runner.on('pending', test => {
5454
if (test.parent && test.parent.pending) {
5555
const suite = test.parent;
5656
const skipInfo = suite.opts.skipInfo || {};
@@ -63,7 +63,7 @@ class Cli extends Base {
6363
output.test.skipped(test);
6464
});
6565

66-
runner.on('pass', (test) => {
66+
runner.on('pass', test => {
6767
if (showSteps && test.steps) {
6868
return output.scenario.passed(test);
6969
}
@@ -72,7 +72,7 @@ class Cli extends Base {
7272
});
7373

7474
if (showSteps) {
75-
runner.on('test', (test) => {
75+
runner.on('test', test => {
7676
currentMetaStep = [];
7777
if (test.steps) {
7878
output.test.started(test);
@@ -82,12 +82,12 @@ class Cli extends Base {
8282
if (!codeceptjsEventDispatchersRegistered) {
8383
codeceptjsEventDispatchersRegistered = true;
8484

85-
event.dispatcher.on(event.bddStep.started, (step) => {
85+
event.dispatcher.on(event.bddStep.started, step => {
8686
output.stepShift = 2;
8787
output.step(step);
8888
});
8989

90-
event.dispatcher.on(event.step.started, (step) => {
90+
event.dispatcher.on(event.step.started, step => {
9191
let processingStep = step;
9292
const metaSteps = [];
9393
while (processingStep.metaStep) {
@@ -118,7 +118,7 @@ class Cli extends Base {
118118
}
119119
}
120120

121-
runner.on('suite end', (suite) => {
121+
runner.on('suite end', suite => {
122122
let skippedCount = 0;
123123
const grep = runner._grep;
124124
for (const test of suite.tests) {
@@ -159,7 +159,7 @@ class Cli extends Base {
159159
// failures
160160
if (stats.failures) {
161161
// append step traces
162-
this.failures.map((test) => {
162+
this.failures.map(test => {
163163
const err = test.err;
164164

165165
let log = '';
@@ -172,7 +172,7 @@ class Cli extends Base {
172172

173173
if (steps && steps.length) {
174174
let scenarioTrace = '';
175-
steps.reverse().forEach((step) => {
175+
steps.reverse().forEach(step => {
176176
const line = `- ${step.toCode()} ${step.line()}`;
177177
// if (step.status === 'failed') line = '' + line;
178178
scenarioTrace += `\n${line}`;
@@ -218,7 +218,7 @@ class Cli extends Base {
218218
console.log();
219219
}
220220

221-
this.failures.forEach((failure) => {
221+
this.failures.forEach(failure => {
222222
if (failure.constructor.name === 'Hook') {
223223
stats.failedHooks += 1;
224224
}

lib/codecept.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Codecept {
3535
*/
3636
requireModules(requiringModules) {
3737
if (requiringModules) {
38-
requiringModules.forEach((requiredModule) => {
38+
requiringModules.forEach(requiredModule => {
3939
const isLocalFile = existsSync(requiredModule) || existsSync(`${requiredModule}.js`);
4040
if (isLocalFile) {
4141
requiredModule = resolve(requiredModule);
@@ -76,7 +76,7 @@ class Codecept {
7676
global.within = require('./within');
7777
global.session = require('./session');
7878
global.DataTable = require('./data/table');
79-
global.locate = (locator) => require('./locator').build(locator);
79+
global.locate = locator => require('./locator').build(locator);
8080
global.inject = container.support;
8181
global.share = container.share;
8282
global.secret = require('./secret').secret;
@@ -112,7 +112,7 @@ class Codecept {
112112
runHook(require('./listener/exit'));
113113

114114
// custom hooks (previous iteration of plugins)
115-
this.config.hooks.forEach((hook) => runHook(hook));
115+
this.config.hooks.forEach(hook => runHook(hook));
116116
}
117117

118118
/**
@@ -156,7 +156,7 @@ class Codecept {
156156

157157
if (this.config.gherkin.features && !this.opts.tests) {
158158
if (Array.isArray(this.config.gherkin.features)) {
159-
this.config.gherkin.features.forEach((feature) => {
159+
this.config.gherkin.features.forEach(feature => {
160160
patterns.push(feature);
161161
});
162162
} else {
@@ -166,7 +166,7 @@ class Codecept {
166166
}
167167

168168
for (pattern of patterns) {
169-
glob.sync(pattern, options).forEach((file) => {
169+
glob.sync(pattern, options).forEach(file => {
170170
if (file.includes('node_modules')) return;
171171
if (!fsPath.isAbsolute(file)) {
172172
file = fsPath.join(global.codecept_dir, file);
@@ -194,7 +194,7 @@ class Codecept {
194194
if (!fsPath.isAbsolute(test)) {
195195
test = fsPath.join(global.codecept_dir, test);
196196
}
197-
mocha.files = mocha.files.filter((t) => fsPath.basename(t, '.js') === test || t === test);
197+
mocha.files = mocha.files.filter(t => fsPath.basename(t, '.js') === test || t === test);
198198
}
199199
const done = () => {
200200
event.emit(event.all.result, this);

lib/command/gherkin/snippets.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ module.exports = function (genPath, options) {
4343
}
4444

4545
const files = [];
46-
glob.sync(options.feature || config.gherkin.features, { cwd: options.feature ? '.' : global.codecept_dir }).forEach((file) => {
46+
glob.sync(options.feature || config.gherkin.features, { cwd: options.feature ? '.' : global.codecept_dir }).forEach(file => {
4747
if (!fsPath.isAbsolute(file)) {
4848
file = fsPath.join(global.codecept_dir, file);
4949
}
@@ -53,7 +53,7 @@ module.exports = function (genPath, options) {
5353

5454
const newSteps = new Map();
5555

56-
const parseSteps = (steps) => {
56+
const parseSteps = steps => {
5757
const newSteps = [];
5858
let currentKeyword = '';
5959
for (const step of steps) {
@@ -86,19 +86,19 @@ module.exports = function (genPath, options) {
8686
return newSteps;
8787
};
8888

89-
const parseFile = (file) => {
89+
const parseFile = file => {
9090
const ast = parser.parse(fs.readFileSync(file).toString());
9191
for (const child of ast.feature.children) {
9292
if (child.scenario.keyword === 'Scenario Outline') continue; // skip scenario outline
9393
parseSteps(child.scenario.steps)
94-
.map((step) => {
94+
.map(step => {
9595
return Object.assign(step, { file: file.replace(global.codecept_dir, '').slice(1) });
9696
})
97-
.map((step) => newSteps.set(`${step.type}(${step})`, step));
97+
.map(step => newSteps.set(`${step.type}(${step})`, step));
9898
}
9999
};
100100

101-
files.forEach((file) => parseFile(file));
101+
files.forEach(file => parseFile(file));
102102

103103
let stepFile = options.path || config.gherkin.steps[0];
104104
if (!fs.existsSync(stepFile)) {
@@ -112,7 +112,7 @@ module.exports = function (genPath, options) {
112112

113113
const snippets = [...newSteps.values()]
114114
.filter((value, index, self) => self.indexOf(value) === index)
115-
.map((step) => {
115+
.map(step => {
116116
return `
117117
${step.type}(${step.regexp ? '/^' : "'"}${step}${step.regexp ? '$/' : "'"}, () => {
118118
// From "${step.file}" ${JSON.stringify(step.location)}

lib/command/workers/runTests.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const { options, tests, testRoot, workerIndex } = workerData;
2424

2525
// hide worker output
2626
if (!options.debug && !options.verbose)
27-
process.stdout.write = (string) => {
27+
process.stdout.write = string => {
2828
stdout += string;
2929
return true;
3030
};
@@ -70,7 +70,7 @@ function filterTests() {
7070
mocha.loadFiles();
7171

7272
for (const suite of mocha.suite.suites) {
73-
suite.tests = suite.tests.filter((test) => tests.indexOf(test.uid) >= 0);
73+
suite.tests = suite.tests.filter(test => tests.indexOf(test.uid) >= 0);
7474
}
7575
}
7676

@@ -111,7 +111,7 @@ function initializeListeners() {
111111
}
112112

113113
if (test.opts) {
114-
Object.keys(test.opts).forEach((k) => {
114+
Object.keys(test.opts).forEach(k => {
115115
if (typeof test.opts[k] === 'object') delete test.opts[k];
116116
if (typeof test.opts[k] === 'function') delete test.opts[k];
117117
});
@@ -192,7 +192,7 @@ function initializeListeners() {
192192
}
193193

194194
if (step.opts) {
195-
Object.keys(step.opts).forEach((k) => {
195+
Object.keys(step.opts).forEach(k => {
196196
if (typeof step.opts[k] === 'object') delete step.opts[k];
197197
if (typeof step.opts[k] === 'function') delete step.opts[k];
198198
});
@@ -212,31 +212,31 @@ function initializeListeners() {
212212

213213
collectStats();
214214
// suite
215-
event.dispatcher.on(event.suite.before, (suite) => sendToParentThread({ event: event.suite.before, workerIndex, data: simplifyTest(suite) }));
216-
event.dispatcher.on(event.suite.after, (suite) => sendToParentThread({ event: event.suite.after, workerIndex, data: simplifyTest(suite) }));
215+
event.dispatcher.on(event.suite.before, suite => sendToParentThread({ event: event.suite.before, workerIndex, data: simplifyTest(suite) }));
216+
event.dispatcher.on(event.suite.after, suite => sendToParentThread({ event: event.suite.after, workerIndex, data: simplifyTest(suite) }));
217217

218218
// calculate duration
219-
event.dispatcher.on(event.test.started, (test) => (test.start = new Date()));
219+
event.dispatcher.on(event.test.started, test => (test.start = new Date()));
220220

221221
// tests
222-
event.dispatcher.on(event.test.before, (test) => sendToParentThread({ event: event.test.before, workerIndex, data: simplifyTest(test) }));
223-
event.dispatcher.on(event.test.after, (test) => sendToParentThread({ event: event.test.after, workerIndex, data: simplifyTest(test) }));
222+
event.dispatcher.on(event.test.before, test => sendToParentThread({ event: event.test.before, workerIndex, data: simplifyTest(test) }));
223+
event.dispatcher.on(event.test.after, test => sendToParentThread({ event: event.test.after, workerIndex, data: simplifyTest(test) }));
224224
// we should force-send correct errors to prevent race condition
225225
event.dispatcher.on(event.test.finished, (test, err) => sendToParentThread({ event: event.test.finished, workerIndex, data: simplifyTest(test, err) }));
226226
event.dispatcher.on(event.test.failed, (test, err) => sendToParentThread({ event: event.test.failed, workerIndex, data: simplifyTest(test, err) }));
227227
event.dispatcher.on(event.test.passed, (test, err) => sendToParentThread({ event: event.test.passed, workerIndex, data: simplifyTest(test, err) }));
228-
event.dispatcher.on(event.test.started, (test) => sendToParentThread({ event: event.test.started, workerIndex, data: simplifyTest(test) }));
229-
event.dispatcher.on(event.test.skipped, (test) => sendToParentThread({ event: event.test.skipped, workerIndex, data: simplifyTest(test) }));
228+
event.dispatcher.on(event.test.started, test => sendToParentThread({ event: event.test.started, workerIndex, data: simplifyTest(test) }));
229+
event.dispatcher.on(event.test.skipped, test => sendToParentThread({ event: event.test.skipped, workerIndex, data: simplifyTest(test) }));
230230

231231
// steps
232-
event.dispatcher.on(event.step.finished, (step) => sendToParentThread({ event: event.step.finished, workerIndex, data: simplifyStep(step) }));
233-
event.dispatcher.on(event.step.started, (step) => sendToParentThread({ event: event.step.started, workerIndex, data: simplifyStep(step) }));
234-
event.dispatcher.on(event.step.passed, (step) => sendToParentThread({ event: event.step.passed, workerIndex, data: simplifyStep(step) }));
235-
event.dispatcher.on(event.step.failed, (step) => sendToParentThread({ event: event.step.failed, workerIndex, data: simplifyStep(step) }));
232+
event.dispatcher.on(event.step.finished, step => sendToParentThread({ event: event.step.finished, workerIndex, data: simplifyStep(step) }));
233+
event.dispatcher.on(event.step.started, step => sendToParentThread({ event: event.step.started, workerIndex, data: simplifyStep(step) }));
234+
event.dispatcher.on(event.step.passed, step => sendToParentThread({ event: event.step.passed, workerIndex, data: simplifyStep(step) }));
235+
event.dispatcher.on(event.step.failed, step => sendToParentThread({ event: event.step.failed, workerIndex, data: simplifyStep(step) }));
236236

237237
event.dispatcher.on(event.hook.failed, (test, err) => sendToParentThread({ event: event.hook.failed, workerIndex, data: simplifyTest(test, err) }));
238238
event.dispatcher.on(event.hook.passed, (test, err) => sendToParentThread({ event: event.hook.passed, workerIndex, data: simplifyTest(test, err) }));
239-
event.dispatcher.on(event.all.failures, (data) => sendToParentThread({ event: event.all.failures, workerIndex, data }));
239+
event.dispatcher.on(event.all.failures, data => sendToParentThread({ event: event.all.failures, workerIndex, data }));
240240

241241
// all
242242
event.dispatcher.once(event.all.result, () => parentPort.close());
@@ -260,7 +260,7 @@ function collectStats() {
260260
event.dispatcher.on(event.test.passed, () => {
261261
stats.passes++;
262262
});
263-
event.dispatcher.on(event.test.failed, (test) => {
263+
event.dispatcher.on(event.test.failed, test => {
264264
if (test.ctx._runnable.title.includes('hook: AfterSuite')) {
265265
stats.failedHooks += 1;
266266
}
@@ -282,7 +282,7 @@ function sendToParentThread(data) {
282282
}
283283

284284
function listenToParentThread() {
285-
parentPort.on('message', (eventData) => {
285+
parentPort.on('message', eventData => {
286286
container.append({ support: eventData.data });
287287
});
288288
}

lib/container.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ function createHelpers(config) {
200200

201201
asyncHelperPromise = asyncHelperPromise
202202
.then(() => HelperClass())
203-
.then((ResolvedHelperClass) => {
203+
.then(ResolvedHelperClass => {
204204
// Check if ResolvedHelperClass is a constructor function
205205
if (typeof ResolvedHelperClass?.constructor !== 'function') {
206206
throw new Error(`Helper class from module '${helperName}' is not a class. Use CJS async module syntax.`);
@@ -267,7 +267,7 @@ function requireHelperFromModule(helperName, config, HelperClass) {
267267
function createSupportObjects(config) {
268268
const asyncWrapper = function (f) {
269269
return function () {
270-
return f.apply(this, arguments).catch((e) => {
270+
return f.apply(this, arguments).catch(e => {
271271
recorder.saveFirstAsyncError(e);
272272
throw e;
273273
});
@@ -415,9 +415,9 @@ function createPlugins(config, options = {}) {
415415
}
416416

417417
function loadGherkinSteps(paths) {
418-
global.Before = (fn) => event.dispatcher.on(event.test.started, fn);
419-
global.After = (fn) => event.dispatcher.on(event.test.finished, fn);
420-
global.Fail = (fn) => event.dispatcher.on(event.test.failed, fn);
418+
global.Before = fn => event.dispatcher.on(event.test.started, fn);
419+
global.After = fn => event.dispatcher.on(event.test.finished, fn);
420+
global.Fail = fn => event.dispatcher.on(event.test.failed, fn);
421421

422422
// If gherkin.steps is string, then this will iterate through that folder and send all step def js files to loadSupportObject
423423
// If gherkin.steps is Array, it will go the old way
@@ -429,7 +429,7 @@ function loadGherkinSteps(paths) {
429429
} else {
430430
const folderPath = paths.startsWith('.') ? path.join(global.codecept_dir, paths) : '';
431431
if (folderPath !== '') {
432-
glob.sync(folderPath).forEach((file) => {
432+
glob.sync(folderPath).forEach(file => {
433433
loadSupportObject(file, `Step Definition from ${file}`);
434434
});
435435
}
@@ -498,7 +498,7 @@ function loadTranslation(locale, vocabularies) {
498498
translation = Translation.createDefault();
499499
}
500500

501-
vocabularies.forEach((v) => translation.loadVocabulary(v));
501+
vocabularies.forEach(v => translation.loadVocabulary(v));
502502

503503
return translation;
504504
}

0 commit comments

Comments
 (0)