@argos-ci/cli 5.1.1 → 5.1.3

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.mjs +8 -8
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ const buildNameOption = new Option("--build-name <string>", "Name of the build,
17
17
  //#endregion
18
18
  //#region src/commands/upload.ts
19
19
  function uploadCommand(program) {
20
- program.command("upload").argument("<directory>", "Directory to upload").description("Upload screenshots to Argos").option("-f, --files <patterns...>", "One or more globs matching image file paths to upload", "**/*.{png,jpg,jpeg}").option("-i, --ignore <patterns...>", "One or more globs matching image file paths to ignore (ex: \"**/*.png **/diff.jpg\")").addOption(tokenOption).addOption(projectOption).addOption(buildNameOption).addOption(new Option("--mode <string>", "Mode of comparison applied. CI for visual regression testing, monitoring for visual monitoring.").default("ci").choices(["ci", "monitoring"]).env("ARGOS_MODE")).addOption(new Option("--parallel", "Enable parallel mode. Run multiple Argos builds and combine them at the end").env("ARGOS_PARALLEL")).addOption(new Option("--parallel-total <number>", "The number of parallel nodes being ran").env("ARGOS_PARALLEL_TOTAL")).addOption(parallelNonceOption).addOption(new Option("--parallel-index <number>", "The index of the parallel node being ran (must be at least 1)").env("ARGOS_PARALLEL_INDEX")).addOption(new Option("--reference-branch <string>", "Branch used as baseline for screenshot comparison").env("ARGOS_REFERENCE_BRANCH")).addOption(new Option("--reference-commit <string>", "Commit used as baseline for screenshot comparison").env("ARGOS_REFERENCE_COMMIT")).addOption(new Option("--threshold <number>", "Sensitivity threshold between 0 and 1. The higher the threshold, the less sensitive the diff will be. Default to 0.5").env("ARGOS_THRESHOLD")).addOption(new Option("--subset", "Whether this build contains only a subset of screenshots.\nThis is useful when a build is created from an incomplete test suite where some tests are skipped.").env("ARGOS_SUBSET")).action(async (directory, options) => {
20
+ program.command("upload").argument("<directory>", "Directory to upload").description("Upload screenshots to Argos").option("-f, --files <patterns...>", "One or more globs matching image file paths to upload", "**/*.{png,jpg,jpeg}").option("-i, --ignore <patterns...>", "One or more globs matching image file paths to ignore (ex: \"**/*.png **/diff.jpg\")").addOption(tokenOption).addOption(projectOption).addOption(buildNameOption).addOption(new Option("--mode <string>", "Mode of comparison applied. CI for visual regression testing, monitoring for visual monitoring.").default("ci").choices(["ci", "monitoring"]).env("ARGOS_MODE")).addOption(new Option("--parallel", "Enable parallel mode. Run multiple Argos builds and combine them at the end.\nCan also be set via the ARGOS_PARALLEL environment variable.")).addOption(new Option("--parallel-total <number>", "The number of parallel nodes being ran").env("ARGOS_PARALLEL_TOTAL")).addOption(parallelNonceOption).addOption(new Option("--parallel-index <number>", "The index of the parallel node being ran (must be at least 1)").env("ARGOS_PARALLEL_INDEX")).addOption(new Option("--reference-branch <string>", "Branch used as baseline for screenshot comparison").env("ARGOS_REFERENCE_BRANCH")).addOption(new Option("--reference-commit <string>", "Commit used as baseline for screenshot comparison").env("ARGOS_REFERENCE_COMMIT")).addOption(new Option("--threshold <number>", "Sensitivity threshold between 0 and 1. The higher the threshold, the less sensitive the diff will be. Default to 0.5").env("ARGOS_THRESHOLD")).addOption(new Option("--subset", "Whether this build contains only a subset of screenshots.\nThis is useful when a build is created from an incomplete test suite where some tests are skipped.\nCan also be set via the ARGOS_SUBSET environment variable.")).action(async (directory, options) => {
21
21
  const spinner = ora("Uploading screenshots").start();
22
22
  try {
23
23
  const parallel = (() => {
@@ -293,7 +293,7 @@ async function fetchAllDiffs(client, project, buildNumber, options) {
293
293
  perPage: String(perPage),
294
294
  ...options?.needsReview ? { needsReview: true } : {}
295
295
  };
296
- const { data, error } = await client.GET("/projects/{owner}/{project}/builds/{buildNumber}/diffs", { params: {
296
+ const { data, error, response } = await client.GET("/projects/{owner}/{project}/builds/{buildNumber}/diffs", { params: {
297
297
  path: {
298
298
  owner: project.account.slug,
299
299
  project: project.name,
@@ -302,7 +302,7 @@ async function fetchAllDiffs(client, project, buildNumber, options) {
302
302
  query
303
303
  } });
304
304
  if (error || !data) {
305
- if (error) throwAPIError(error);
305
+ if (error) throwAPIError(error, response);
306
306
  throw new Error("Unexpected empty response from API.");
307
307
  }
308
308
  results.push(...data.results);
@@ -312,8 +312,8 @@ async function fetchAllDiffs(client, project, buildNumber, options) {
312
312
  return results;
313
313
  }
314
314
  async function fetchProject(client) {
315
- const { data, error } = await client.GET("/project");
316
- if (error) throwAPIError(error);
315
+ const { data, error, response } = await client.GET("/project");
316
+ if (error) throwAPIError(error, response);
317
317
  if (!data) {
318
318
  console.error("Error: Unexpected empty response from API.");
319
319
  process.exit(1);
@@ -331,7 +331,7 @@ async function fetchBuildByNumber(client, project, buildNumber, errorLabel) {
331
331
  console.error(`Error: Build number ${errorLabel} not found.`);
332
332
  process.exit(1);
333
333
  }
334
- throwAPIError(error);
334
+ throwAPIError(error, response);
335
335
  }
336
336
  if (!data) {
337
337
  console.error("Error: Unexpected empty response from API.");
@@ -391,7 +391,7 @@ function buildCommand(program) {
391
391
  console.error("Error: --project <owner/project> is required for build-number references.");
392
392
  process.exit(1);
393
393
  }
394
- const { data, error } = await createClient({
394
+ const { data, error, response } = await createClient({
395
395
  authToken: await getTokenOrExit(options),
396
396
  baseUrl: getAPIBaseURL()
397
397
  }).POST("/projects/{owner}/{project}/builds/{buildNumber}/reviews", {
@@ -403,7 +403,7 @@ function buildCommand(program) {
403
403
  body: { conclusion }
404
404
  });
405
405
  if (error) {
406
- const message = formatAPIError(error);
406
+ const message = formatAPIError(error, response);
407
407
  throw new Error([
408
408
  `Failed to create review for ${owner}/${project} build #${buildReferenceDetails.buildNumber}: ${message}`,
409
409
  "Make sure the token passed with --token is a user access token with access to this project.",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@argos-ci/cli",
3
3
  "description": "Command-line (CLI) for visual testing with Argos.",
4
- "version": "5.1.1",
4
+ "version": "5.1.3",
5
5
  "bin": {
6
6
  "argos": "./bin/argos-cli.js"
7
7
  },
@@ -34,8 +34,8 @@
34
34
  "access": "public"
35
35
  },
36
36
  "dependencies": {
37
- "@argos-ci/api-client": "0.22.0",
38
- "@argos-ci/core": "6.2.1",
37
+ "@argos-ci/api-client": "0.22.1",
38
+ "@argos-ci/core": "6.2.3",
39
39
  "commander": "^15.0.0",
40
40
  "open": "^11.0.0",
41
41
  "ora": "^9.4.0",
@@ -53,5 +53,5 @@
53
53
  "check-format": "prettier --check --ignore-unknown --ignore-path=../../.gitignore --ignore-path=../../.prettierignore .",
54
54
  "lint": "eslint ."
55
55
  },
56
- "gitHead": "b9d109dc1fa7d98c4fc2cafac2e310fc22b63c43"
56
+ "gitHead": "70ab43ebd8cbeeb25bb95e978556bbe754b8c073"
57
57
  }