UNPKG

@web/test-runner-saucelabs

Version:
36 lines 1.34 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SauceLabsLauncher = void 0; const test_runner_webdriver_1 = require("@web/test-runner-webdriver"); const internal_ip_1 = __importDefault(require("internal-ip")); const localIp = internal_ip_1.default.v4.sync(); if (!localIp) { throw new Error('Can not determine the local IP.'); } class SauceLabsLauncher extends test_runner_webdriver_1.WebdriverLauncher { constructor(manager, name, options) { super(options); this.manager = manager; this.name = name; } startSession(sessionId, url) { return super.startSession(sessionId, url.replace(/(localhost|127\.0\.0\.1)/, localIp)); } async startDebugSession() { throw new Error('Starting a debug session is not supported in SauceLabs'); } async initialize(config) { await this.manager.registerLauncher(this); return super.initialize(config); } async stop() { const stopPromise = super.stop(); await this.manager.deregisterLauncher(this); return stopPromise; } } exports.SauceLabsLauncher = SauceLabsLauncher; //# sourceMappingURL=SauceLabsLauncher.js.map