@lambdatest/smartui-cli 4.1.19 → 4.1.21

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.
Files changed (2) hide show
  1. package/dist/index.cjs +34 -5
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1249,6 +1249,32 @@ var validateSnapshot = ajv.compile(SnapshotSchema);
1249
1249
  var validateFigmaDesignConfig = ajv.compile(FigmaDesignConfigSchema);
1250
1250
  var validateWebFigmaConfig = ajv.compile(FigmaWebConfigSchema);
1251
1251
  var validateAppFigmaConfig = ajv.compile(FigmaAppConfigSchema);
1252
+ var validateConfigForScheduled = (config) => {
1253
+ validateConfigForScheduled.errors = null;
1254
+ if (!validateConfig(config)) {
1255
+ let errors = validateConfig.errors || [];
1256
+ errors = errors.filter((error) => {
1257
+ const message = error.message || "";
1258
+ return !message.includes("max unique viewports allowed - 5");
1259
+ });
1260
+ if (config.web && config.web.viewports && Array.isArray(config.web.viewports)) {
1261
+ if (config.web.viewports.length > 8) {
1262
+ errors.push({
1263
+ message: "Invalid config; max unique viewports allowed - 8 (scheduled build)",
1264
+ keyword: "maxItems",
1265
+ instancePath: "/web/viewports",
1266
+ schemaPath: "#/properties/web/properties/viewports/maxItems"
1267
+ });
1268
+ }
1269
+ }
1270
+ if (errors.length > 0) {
1271
+ validateConfigForScheduled.errors = errors;
1272
+ return false;
1273
+ }
1274
+ }
1275
+ return true;
1276
+ };
1277
+ validateConfigForScheduled.errors = null;
1252
1278
  var lambdaTunnel = __require("@lambdatest/node-tunnel");
1253
1279
  util.promisify(setTimeout);
1254
1280
  var tunnelInstance;
@@ -1877,7 +1903,7 @@ var authExec_default = (ctx) => {
1877
1903
  };
1878
1904
 
1879
1905
  // package.json
1880
- var version = "4.1.19";
1906
+ var version = "4.1.21";
1881
1907
  var package_default = {
1882
1908
  name: "@lambdatest/smartui-cli",
1883
1909
  version,
@@ -2480,8 +2506,9 @@ var ctx_default = (options) => {
2480
2506
  config.web.viewports = config.web.resolutions;
2481
2507
  delete config.web.resolutions;
2482
2508
  }
2483
- if (!validateConfig(config)) {
2484
- throw new Error(validateConfig.errors[0].message);
2509
+ let validateConfigFn = options.scheduled ? validateConfigForScheduled : validateConfig;
2510
+ if (!validateConfigFn(config)) {
2511
+ throw new Error(validateConfigFn.errors[0].message);
2485
2512
  }
2486
2513
  } else {
2487
2514
  logger_default.info("## No config file provided. Using default config.");
@@ -2513,7 +2540,7 @@ var ctx_default = (options) => {
2513
2540
  }
2514
2541
  } catch (error) {
2515
2542
  console.log(`[smartui] Error: ${error.message}`);
2516
- process.exit();
2543
+ process.exit(1);
2517
2544
  }
2518
2545
  if (config.web) {
2519
2546
  webConfig = { browsers: config.web.browsers, viewports: [] };
@@ -4622,7 +4649,7 @@ var captureScreenshots_default = (ctx) => {
4622
4649
 
4623
4650
  // src/commander/capture.ts
4624
4651
  var command2 = new commander.Command();
4625
- command2.name("capture").description("Capture screenshots of static sites").argument("<file>", "Web static config file").option("-C, --parallel [number]", "Specify the number of instances per browser", parseInt).option("-F, --force", "forcefully apply the specified parallel instances per browser").option("--fetch-results [filename]", "Fetch results and optionally specify an output file, e.g., <filename>.json").option("--buildName <string>", "Specify the build name").option("--userName <string>", "Specify the LT username").option("--accessKey <string>", "Specify the LT accesskey").action(function(file, _, command9) {
4652
+ command2.name("capture").description("Capture screenshots of static sites").argument("<file>", "Web static config file").option("-C, --parallel [number]", "Specify the number of instances per browser", parseInt).option("-F, --force", "forcefully apply the specified parallel instances per browser").option("--fetch-results [filename]", "Fetch results and optionally specify an output file, e.g., <filename>.json").option("--buildName <string>", "Specify the build name").option("--scheduled <string>", "Specify the schedule ID").option("--userName <string>", "Specify the LT username").option("--accessKey <string>", "Specify the LT accesskey").action(function(file, _, command9) {
4626
4653
  return __async(this, null, function* () {
4627
4654
  var _a, _b;
4628
4655
  const options = command9.optsWithGlobals();
@@ -4656,6 +4683,7 @@ command2.name("capture").description("Capture screenshots of static sites").argu
4656
4683
  }
4657
4684
  } catch (error) {
4658
4685
  ctx.log.error(`Invalid Web Static Config; ${error.message}`);
4686
+ process.exitCode = 1;
4659
4687
  return;
4660
4688
  }
4661
4689
  ctx.log.debug(ctx.config);
@@ -4683,6 +4711,7 @@ command2.name("capture").description("Capture screenshots of static sites").argu
4683
4711
  } catch (error) {
4684
4712
  console.log("\nRefer docs: https://www.lambdatest.com/support/docs/smart-visual-regression-testing/");
4685
4713
  process.exitCode = 1;
4714
+ throw new Error();
4686
4715
  }
4687
4716
  });
4688
4717
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambdatest/smartui-cli",
3
- "version": "4.1.19",
3
+ "version": "4.1.21",
4
4
  "description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
5
5
  "files": [
6
6
  "dist/**/*"