Skip to content

chore: remove wdio v5 leftover #3587

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

Merged
merged 1 commit into from
Feb 15, 2023
Merged
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
16 changes: 4 additions & 12 deletions lib/plugin/wdio.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const debug = require('debug')('codeceptjs:plugin:wdio');
const path = require('path');
const fs = require('fs');

const container = require('../container');
const mainConfig = require('../config');
Expand Down Expand Up @@ -100,21 +98,15 @@ module.exports = (config) => {
const launchers = [];

for (const name of config.services) {
// webdriverio v5 style
const Service = safeRequire(`@wdio/${name.toLowerCase()}-service`);
if (Service) {
if (Service.launcher && typeof Service.launcher === 'function') {
const Launcher = Service.launcher;

const version = JSON.parse(fs.readFileSync(path.join(require.resolve('webdriverio'), '/../../', 'package.json')).toString()).version;
if (version.indexOf('5') === 0) {
launchers.push(new Launcher(config));
} else {
const options = {
logPath: global.output_dir, installArgs: seleniumInstallArgs, args: seleniumArgs, ...wdioOptions,
};
launchers.push(new Launcher(options, [config.capabilities], config));
}
const options = {
logPath: global.output_dir, installArgs: seleniumInstallArgs, args: seleniumArgs, ...wdioOptions,
};
launchers.push(new Launcher(options, [config.capabilities], config));
}
if (typeof Service === 'function') {
services.push(new Service(config, config.capabilities));
Expand Down