@argos-ci/core 4.0.1 → 4.0.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.
package/dist/index.d.ts CHANGED
@@ -165,13 +165,29 @@ interface components {
165
165
  repeat?: number | null;
166
166
  /** @description The location of the test in the source code */
167
167
  location?: {
168
- /** @description The file where the test is located */
168
+ /** @description The located file */
169
169
  file: string;
170
170
  /** @description The line number in the file */
171
171
  line: number;
172
172
  /** @description The column number in the file */
173
173
  column: number;
174
174
  };
175
+ /** @description Annotations associated to the test */
176
+ annotations?: {
177
+ /** @description The type of annotation */
178
+ type: string;
179
+ /** @description The description of the annotation */
180
+ description?: string;
181
+ /** @description The location of the annotation in the source code */
182
+ location?: {
183
+ /** @description The located file */
184
+ file: string;
185
+ /** @description The line number in the file */
186
+ line: number;
187
+ /** @description The column number in the file */
188
+ column: number;
189
+ };
190
+ }[];
175
191
  } | null) | null;
176
192
  browser?: {
177
193
  /** @description The name of the browser */
package/dist/index.js CHANGED
@@ -57,23 +57,30 @@ function getRepositoryURL() {
57
57
  return null;
58
58
  }
59
59
  }
60
- function getMergeBaseCommitShaWithDepth(input) {
61
- execSync(
62
- `git fetch --update-head-ok --depth ${input.depth} origin ${input.head}:${input.head}`
63
- );
60
+ function gitMergeBase(input) {
61
+ try {
62
+ return execSync(`git merge-base ${input.head} ${input.base}`).toString().trim();
63
+ } catch (error) {
64
+ if (checkIsExecError(error) && error.status === 1 && error.stderr.toString() === "") {
65
+ return null;
66
+ }
67
+ throw error;
68
+ }
69
+ }
70
+ function gitFetch(input) {
64
71
  execSync(
65
- `git fetch --update-head-ok --depth ${input.depth} origin ${input.base}:${input.base}`
72
+ `git fetch --update-head-ok --depth ${input.depth} origin ${input.ref}:${input.ref}`
66
73
  );
67
- const mergeBase = execSync(`git merge-base ${input.head} ${input.base}`).toString().trim();
68
- return mergeBase || null;
74
+ }
75
+ function checkIsExecError(error) {
76
+ return error instanceof Error && "status" in error && typeof error.status === "number" && "stderr" in error && Buffer.isBuffer(error.stderr);
69
77
  }
70
78
  function getMergeBaseCommitSha(input) {
71
79
  let depth = 200;
72
80
  while (depth < 1e3) {
73
- const mergeBase = getMergeBaseCommitShaWithDepth({
74
- depth,
75
- ...input
76
- });
81
+ gitFetch({ ref: input.head, depth });
82
+ gitFetch({ ref: input.base, depth });
83
+ const mergeBase = gitMergeBase(input);
77
84
  if (mergeBase) {
78
85
  return mergeBase;
79
86
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@argos-ci/core",
3
3
  "description": "Node.js SDK for visual testing with Argos.",
4
- "version": "4.0.1",
4
+ "version": "4.0.3",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "exports": {
@@ -40,8 +40,8 @@
40
40
  "access": "public"
41
41
  },
42
42
  "dependencies": {
43
- "@argos-ci/api-client": "0.9.0",
44
- "@argos-ci/util": "3.0.0",
43
+ "@argos-ci/api-client": "0.10.0",
44
+ "@argos-ci/util": "3.1.0",
45
45
  "convict": "^6.2.4",
46
46
  "debug": "^4.4.0",
47
47
  "fast-glob": "^3.3.3",
@@ -64,5 +64,5 @@
64
64
  "lint": "eslint .",
65
65
  "test": "vitest"
66
66
  },
67
- "gitHead": "db55659eaaffc6a3a92655f621be0d6344901da2"
67
+ "gitHead": "dfad527145f58037c1991c2a85ad8cdc0d8a1a3f"
68
68
  }