Skip to content

Commit 9eeb4e9

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

22 files changed

+246
-786
lines changed

lib/command/gherkin/snippets.js

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

4545
const files = [];
46-
glob
47-
.sync(options.feature || config.gherkin.features, { cwd: options.feature ? '.' : global.codecept_dir })
48-
.forEach((file) => {
49-
if (!fsPath.isAbsolute(file)) {
50-
file = fsPath.join(global.codecept_dir, file);
51-
}
52-
files.push(fsPath.resolve(file));
53-
});
46+
glob.sync(options.feature || config.gherkin.features, { cwd: options.feature ? '.' : global.codecept_dir }).forEach((file) => {
47+
if (!fsPath.isAbsolute(file)) {
48+
file = fsPath.join(global.codecept_dir, file);
49+
}
50+
files.push(fsPath.resolve(file));
51+
});
5452
output.print(`Loaded ${files.length} files`);
5553

5654
const newSteps = new Map();

lib/command/workers/runTests.js

Lines changed: 17 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -212,63 +212,31 @@ function initializeListeners() {
212212

213213
collectStats();
214214
// suite
215-
event.dispatcher.on(event.suite.before, (suite) =>
216-
sendToParentThread({ event: event.suite.before, workerIndex, data: simplifyTest(suite) }),
217-
);
218-
event.dispatcher.on(event.suite.after, (suite) =>
219-
sendToParentThread({ event: event.suite.after, workerIndex, data: simplifyTest(suite) }),
220-
);
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) }));
221217

222218
// calculate duration
223219
event.dispatcher.on(event.test.started, (test) => (test.start = new Date()));
224220

225221
// tests
226-
event.dispatcher.on(event.test.before, (test) =>
227-
sendToParentThread({ event: event.test.before, workerIndex, data: simplifyTest(test) }),
228-
);
229-
event.dispatcher.on(event.test.after, (test) =>
230-
sendToParentThread({ event: event.test.after, workerIndex, data: simplifyTest(test) }),
231-
);
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) }));
232224
// we should force-send correct errors to prevent race condition
233-
event.dispatcher.on(event.test.finished, (test, err) =>
234-
sendToParentThread({ event: event.test.finished, workerIndex, data: simplifyTest(test, err) }),
235-
);
236-
event.dispatcher.on(event.test.failed, (test, err) =>
237-
sendToParentThread({ event: event.test.failed, workerIndex, data: simplifyTest(test, err) }),
238-
);
239-
event.dispatcher.on(event.test.passed, (test, err) =>
240-
sendToParentThread({ event: event.test.passed, workerIndex, data: simplifyTest(test, err) }),
241-
);
242-
event.dispatcher.on(event.test.started, (test) =>
243-
sendToParentThread({ event: event.test.started, workerIndex, data: simplifyTest(test) }),
244-
);
245-
event.dispatcher.on(event.test.skipped, (test) =>
246-
sendToParentThread({ event: event.test.skipped, workerIndex, data: simplifyTest(test) }),
247-
);
225+
event.dispatcher.on(event.test.finished, (test, err) => sendToParentThread({ event: event.test.finished, workerIndex, data: simplifyTest(test, err) }));
226+
event.dispatcher.on(event.test.failed, (test, err) => sendToParentThread({ event: event.test.failed, workerIndex, data: simplifyTest(test, err) }));
227+
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) }));
248230

249231
// steps
250-
event.dispatcher.on(event.step.finished, (step) =>
251-
sendToParentThread({ event: event.step.finished, workerIndex, data: simplifyStep(step) }),
252-
);
253-
event.dispatcher.on(event.step.started, (step) =>
254-
sendToParentThread({ event: event.step.started, workerIndex, data: simplifyStep(step) }),
255-
);
256-
event.dispatcher.on(event.step.passed, (step) =>
257-
sendToParentThread({ event: event.step.passed, workerIndex, data: simplifyStep(step) }),
258-
);
259-
event.dispatcher.on(event.step.failed, (step) =>
260-
sendToParentThread({ event: event.step.failed, workerIndex, data: simplifyStep(step) }),
261-
);
262-
263-
event.dispatcher.on(event.hook.failed, (test, err) =>
264-
sendToParentThread({ event: event.hook.failed, workerIndex, data: simplifyTest(test, err) }),
265-
);
266-
event.dispatcher.on(event.hook.passed, (test, err) =>
267-
sendToParentThread({ event: event.hook.passed, workerIndex, data: simplifyTest(test, err) }),
268-
);
269-
event.dispatcher.on(event.all.failures, (data) =>
270-
sendToParentThread({ event: event.all.failures, workerIndex, data }),
271-
);
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) }));
236+
237+
event.dispatcher.on(event.hook.failed, (test, err) => sendToParentThread({ event: event.hook.failed, workerIndex, data: simplifyTest(test, err) }));
238+
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 }));
272240

273241
// all
274242
event.dispatcher.once(event.all.result, () => parentPort.close());

lib/container.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -251,16 +251,12 @@ function requireHelperFromModule(helperName, config, HelperClass) {
251251
try {
252252
const mod = require(moduleName);
253253
if (!mod && !mod.default) {
254-
throw new Error(
255-
`Helper module '${moduleName}' was not found. Make sure you have installed the package correctly.`,
256-
);
254+
throw new Error(`Helper module '${moduleName}' was not found. Make sure you have installed the package correctly.`);
257255
}
258256
HelperClass = mod.default || mod;
259257
} catch (err) {
260258
if (err.code === 'MODULE_NOT_FOUND') {
261-
throw new Error(
262-
`Helper module '${moduleName}' was not found. Make sure you have installed the package correctly.`,
263-
);
259+
throw new Error(`Helper module '${moduleName}' was not found. Make sure you have installed the package correctly.`);
264260
}
265261
throw err;
266262
}
@@ -317,9 +313,7 @@ function createSupportObjects(config) {
317313
container.support[name]._init();
318314
}
319315
} catch (err) {
320-
throw new Error(
321-
`Initialization failed for ${name}: ${container.support[name]}\n${err.message}\n${err.stack}`,
322-
);
316+
throw new Error(`Initialization failed for ${name}: ${container.support[name]}\n${err.message}\n${err.stack}`);
323317
}
324318
}
325319

@@ -476,13 +470,9 @@ function loadSupportObject(modulePath, supportObjectName) {
476470
return obj;
477471
}
478472

479-
throw new Error(
480-
`Support object "${supportObjectName}" should be an object, class, or function, but got ${typeof obj}`,
481-
);
473+
throw new Error(`Support object "${supportObjectName}" should be an object, class, or function, but got ${typeof obj}`);
482474
} catch (err) {
483-
throw new Error(
484-
`Could not include object ${supportObjectName} from module '${modulePath}'\n${err.message}\n${err.stack}`,
485-
);
475+
throw new Error(`Could not include object ${supportObjectName} from module '${modulePath}'\n${err.message}\n${err.stack}`);
486476
}
487477
}
488478

lib/heal.js

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ class Heal {
4848
}
4949

5050
hasCorrespondingRecipes(step) {
51-
return (
52-
matchRecipes(this.recipes, this.contextName).filter((r) => !r.steps || r.steps.includes(step.name)).length > 0
53-
);
51+
return matchRecipes(this.recipes, this.contextName).filter((r) => !r.steps || r.steps.includes(step.name)).length > 0;
5452
}
5553

5654
async getCodeSuggestions(context) {
@@ -131,12 +129,7 @@ class Heal {
131129
snippet: codeSnippet,
132130
});
133131

134-
recorder.add('healed', () =>
135-
output.print(
136-
colors.bold.green(` Code healed successfully by ${suggestion.name}`),
137-
colors.gray('(no errors thrown)'),
138-
),
139-
);
132+
recorder.add('healed', () => output.print(colors.bold.green(` Code healed successfully by ${suggestion.name}`), colors.gray('(no errors thrown)')));
140133
this.numHealed++;
141134
// recorder.session.restore();
142135
return;
@@ -173,10 +166,5 @@ function matchRecipes(recipes, contextName) {
173166
}
174167

175168
function isBlank(value) {
176-
return (
177-
value == null ||
178-
(Array.isArray(value) && value.length === 0) ||
179-
(typeof value === 'object' && Object.keys(value).length === 0) ||
180-
(typeof value === 'string' && value.trim() === '')
181-
);
169+
return value == null || (Array.isArray(value) && value.length === 0) || (typeof value === 'object' && Object.keys(value).length === 0) || (typeof value === 'string' && value.trim() === '');
182170
}

lib/helper/JSONResponse.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ class JSONResponse extends Helper {
7070
_beforeSuite() {
7171
this.response = null;
7272
if (!this.helpers[this.options.requestHelper]) {
73-
throw new Error(
74-
`Error setting JSONResponse, helper ${this.options.requestHelper} is not enabled in config, helpers: ${Object.keys(this.helpers)}`,
75-
);
73+
throw new Error(`Error setting JSONResponse, helper ${this.options.requestHelper} is not enabled in config, helpers: ${Object.keys(this.helpers)}`);
7674
}
7775
// connect to REST helper
7876
this.helpers[this.options.requestHelper].config.onResponse = (response) => {

lib/pause.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ function pauseSession(passedObject = {}) {
5151
output.print(colors.yellow(` - Prefix ${colors.bold('=>')} to run js commands ${colors.bold(vars)}`));
5252

5353
if (aiAssistant.isEnabled) {
54-
output.print(
55-
colors.blue(` ${colors.bold('AI is enabled! (experimental)')} Write what you want and make AI run it`),
56-
);
54+
output.print(colors.blue(` ${colors.bold('AI is enabled! (experimental)')} Write what you want and make AI run it`));
5755
output.print(colors.blue(' Please note, only HTML fragments with interactive elements are sent to AI provider'));
5856
output.print(colors.blue(' Ideas: ask it to fill forms for you or to click'));
5957
}

lib/workers.js

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,7 @@ class Workers extends EventEmitter {
259259

260260
_initWorkers(numberOfWorkers, config) {
261261
this.splitTestsByGroups(numberOfWorkers, config);
262-
this.workers = createWorkerObjects(
263-
this.testGroups,
264-
this.codecept.config,
265-
config.testConfig,
266-
config.options,
267-
config.selectedRuns,
268-
);
262+
this.workers = createWorkerObjects(this.testGroups, this.codecept.config, config.testConfig, config.options, config.selectedRuns);
269263
this.numberOfWorkers = this.workers.length;
270264
}
271265

@@ -292,8 +286,7 @@ class Workers extends EventEmitter {
292286
this.testGroups.push(convertToMochaTests(testGroup));
293287
}
294288
} else if (typeof numberOfWorkers === 'number' && numberOfWorkers > 0) {
295-
this.testGroups =
296-
config.by === 'suite' ? this.createGroupsOfSuites(numberOfWorkers) : this.createGroupsOfTests(numberOfWorkers);
289+
this.testGroups = config.by === 'suite' ? this.createGroupsOfSuites(numberOfWorkers) : this.createGroupsOfTests(numberOfWorkers);
297290
}
298291
}
299292

@@ -508,13 +501,7 @@ class Workers extends EventEmitter {
508501
this.failuresLog.forEach((log) => output.print(...log));
509502
}
510503

511-
output.result(
512-
this.stats.passes,
513-
this.stats.failures,
514-
this.stats.pending,
515-
ms(this.stats.duration),
516-
this.stats.failedHooks,
517-
);
504+
output.result(this.stats.passes, this.stats.failures, this.stats.pending, ms(this.stats.duration), this.stats.failedHooks);
518505
process.env.RUNS_WITH_WORKERS = 'false';
519506
}
520507
}

prettier.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
printWidth: 120,
2+
printWidth: 220,
33
tabWidth: 2,
44
useTabs: false,
55
semi: true,

test/helper/AppiumV2_ios_test.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ describe('Appium iOS Tests', function () {
100100
try {
101101
await app.hideDeviceKeyboard('pressKey', 'Done');
102102
} catch (e) {
103-
e.message.should.include(
104-
'An unknown server-side error occurred while processing the command. Original error: Soft keyboard not present, cannot hide keyboard',
105-
);
103+
e.message.should.include('An unknown server-side error occurred while processing the command. Original error: Soft keyboard not present, cannot hide keyboard');
106104
}
107105
});
108106
});
@@ -130,9 +128,7 @@ describe('Appium iOS Tests', function () {
130128
try {
131129
await app.waitForText('Nothing here', 1, '~IntegerA');
132130
} catch (e) {
133-
e.message.should.contain(
134-
'element (~IntegerA) is not in DOM or there is no element(~IntegerA) with text "Nothing here" after 1 sec',
135-
);
131+
e.message.should.contain('element (~IntegerA) is not in DOM or there is no element(~IntegerA) with text "Nothing here" after 1 sec');
136132
}
137133
});
138134
});

0 commit comments

Comments
 (0)