webdriverio-automation
Version:
WebdriverIO-Automation android ios project
33 lines (23 loc) • 983 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = initialisePlugin;
var _path = _interopRequireDefault(require("path"));
var _utils = require("./utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function initialisePlugin(name, type) {
if (name[0] === '@' || _path.default.isAbsolute(name)) {
const service = (0, _utils.safeRequire)(name);
return service;
}
const scopedPlugin = (0, _utils.safeRequire)(`@wdio/${name.toLowerCase()}-${type}`);
if (scopedPlugin) {
return scopedPlugin;
}
const plugin = (0, _utils.safeRequire)(`wdio-${name.toLowerCase()}-${type}`);
if (plugin) {
return plugin;
}
throw new Error(`Couldn't find plugin "${name}" ${type}, neither as wdio scoped package ` + `"@wdio/${name.toLowerCase()}-${type}" nor as community package ` + `"wdio-${name.toLowerCase()}-${type}". Please make sure you have it installed!`);
}
;