wdio-lambdatest-service-sdk 5.1.4 → 5.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,17 +1,17 @@
1
1
  /**
2
2
  * WDIO LambdaTest service entry point.
3
- * Exposes the service class and launcher for WebdriverIO.
4
- * Export shape supports both CommonJS and WDIO plugin resolution (default + launcher).
3
+ * Export shape: object with default (worker service) and launcher (main process)
4
+ * so @wdio/utils initialisePlugin never sees null when reading .launcher or .default.
5
5
  */
6
6
  const LambdaTestService = require('./src/service');
7
7
  const LambdaTestLauncher = require('./src/launcher');
8
8
 
9
- // Primary export: the worker service class (used by WDIO in worker process)
10
9
  const Service = LambdaTestService;
11
-
12
- // Attach launcher so WDIO can read plugin.launcher (main process)
13
10
  Service.launcher = LambdaTestLauncher;
14
- // ESM interop: some loaders expect plugin.default
15
11
  Service.default = Service;
16
12
 
17
- module.exports = Service;
13
+ // Export object so require() never returns null and plugin.launcher / plugin.default always exist
14
+ module.exports = {
15
+ default: Service,
16
+ launcher: LambdaTestLauncher
17
+ };
@@ -164,11 +164,12 @@ function buildCapabilitiesMulti(config) {
164
164
  }
165
165
 
166
166
  /**
167
- * Resolve LambdaTest service path: try package name first (npm install), then sibling (reference repo).
168
- * Reference repo layout: LT_Test/ (configs) and wdio-lambdatest-service/ as siblings.
167
+ * Resolve LambdaTest service: try wdio-lambdatest-service-sdk then wdio-lambdatest-service (npm), then sibling path.
168
+ * Package can be installed as wdio-lambdatest-service-sdk or wdio-lambdatest-service.
169
169
  */
170
170
  function getServicePathSnippet() {
171
171
  return `(function () {
172
+ try { return require.resolve('wdio-lambdatest-service-sdk'); } catch (e) {}
172
173
  try { return require.resolve('wdio-lambdatest-service'); } catch (e) {}
173
174
  return path.join(__dirname, '../wdio-lambdatest-service');
174
175
  })()`;
@@ -180,7 +181,11 @@ function getServicePathSnippet() {
180
181
  */
181
182
  function buildConfigTemplate(config, commonCaps, capabilities) {
182
183
  const servicePathExpr = getServicePathSnippet();
183
- const safeSpecPath = config.specPath.replace(/\\/g, '/');
184
+ // Normalize: relative path only; no absolute paths or quotes (WDIO resolves from config dir)
185
+ let safeSpecPath = (config.specPath || '../specs/android-test.js').replace(/\\/g, '/').trim();
186
+ if (path.isAbsolute(safeSpecPath) || !safeSpecPath || /['"]/.test(safeSpecPath)) {
187
+ safeSpecPath = '../specs/android-test.js';
188
+ }
184
189
  const mergeSnippet = capabilities.length > 0
185
190
  ? `
186
191
  // Merge commonCapabilities into each capability
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wdio-lambdatest-service-sdk",
3
- "version": "5.1.4",
3
+ "version": "5.1.6",
4
4
  "description": "WebdriverIO service and CLI for LambdaTest Appium & browser automation",
5
5
  "main": "index.js",
6
6
  "repository": {