@argos-ci/core 5.1.2 → 5.2.0

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 DELETED
@@ -1,702 +0,0 @@
1
- import { ArgosAPISchema } from '@argos-ci/api-client';
2
- import { ScreenshotMetadata } from '@argos-ci/util';
3
-
4
- interface Config {
5
- /**
6
- * Base URL of the Argos API.
7
- * Use this to target a self-hosted installation.
8
- * @default "https://api.argos-ci.com/v2/"
9
- */
10
- apiBaseUrl: string;
11
- /**
12
- * Git commit SHA.
13
- */
14
- commit: string;
15
- /**
16
- * Git branch name of the build.
17
- * @example "main", "develop", "release/1.0"
18
- */
19
- branch: string;
20
- /**
21
- * Argos repository access token.
22
- */
23
- token: string | null;
24
- /**
25
- * Custom build name.
26
- * Useful for multi-build setups on the same commit.
27
- */
28
- buildName: string | null;
29
- /**
30
- * Whether this build is split across multiple parallel jobs.
31
- * @default false
32
- */
33
- parallel: boolean;
34
- /**
35
- * Unique identifier shared by all parallel jobs.
36
- */
37
- parallelNonce: string | null;
38
- /**
39
- * Index of the current parallel job.
40
- * Must be between 1 and `parallelTotal`, or null if not set.
41
- */
42
- parallelIndex: number | null;
43
- /**
44
- * Total number of parallel jobs.
45
- * Use -1 if unknown, or null if not set.
46
- */
47
- parallelTotal: number | null;
48
- /**
49
- * Git branch used as the baseline for screenshot comparison.
50
- */
51
- referenceBranch: string | null;
52
- /**
53
- * Git commit SHA used as the baseline for screenshot comparison.
54
- */
55
- referenceCommit: string | null;
56
- /**
57
- * Repository slug of the source repository.
58
- * Example: "my-org/my-repo" or "my-user/my-repo".
59
- * If from a fork, this refers to the fork repository.
60
- */
61
- repository: string | null;
62
- /**
63
- * Repository slug of the original (base) repository.
64
- * Example: "my-org/my-repo" or "my-user/my-repo".
65
- * If from a fork, this refers to the base repository.
66
- */
67
- originalRepository: string | null;
68
- /**
69
- * CI job identifier (if provided by the CI environment).
70
- */
71
- jobId: string | null;
72
- /**
73
- * CI run identifier (if provided by the CI environment).
74
- */
75
- runId: string | null;
76
- /**
77
- * CI run attempt number (if provided by the CI environment).
78
- */
79
- runAttempt: number | null;
80
- /**
81
- * Pull request number associated with the build.
82
- */
83
- prNumber: number | null;
84
- /**
85
- * Pull request head commit SHA (if available).
86
- */
87
- prHeadCommit: string | null;
88
- /**
89
- * Pull request base branch (if available).
90
- */
91
- prBaseBranch: string | null;
92
- /**
93
- * Build mode to use.
94
- * - "ci": Review visual changes introduced by a feature branch and prevent regressions.
95
- * - "monitoring": Track visual changes outside the standard CI flow, either on a schedule or before a release.
96
- * @see https://argos-ci.com/docs/build-modes
97
- */
98
- mode: "ci" | "monitoring" | null;
99
- /**
100
- * Name of the detected CI provider (if available).
101
- * @example "github-actions", "gitlab-ci", "circleci"
102
- */
103
- ciProvider: string | null;
104
- /**
105
- * Diff sensitivity threshold between 0 and 1.
106
- * Higher values make Argos less sensitive to differences.
107
- */
108
- threshold: number | null;
109
- /**
110
- * Base URL to use for preview links.
111
- * @example "https://my-preview.example.com"
112
- */
113
- previewBaseUrl: string | null;
114
- /**
115
- * Skip this build.
116
- * No screenshots are uploaded, and the commit status is marked as success.
117
- */
118
- skipped?: boolean;
119
- /**
120
- * Whether the environment is a merge queue.
121
- */
122
- mergeQueue?: boolean;
123
- /**
124
- * Whether this build contains only a subset of screenshots.
125
- * This is useful when a build is created from an incomplete test suite where some tests are skipped.
126
- */
127
- subset?: boolean;
128
- }
129
- declare function readConfig(options?: Partial<Config>): Promise<Config>;
130
- declare function getConfigFromOptions({ parallel, ...options }: Omit<Partial<Config>, "parallel"> & {
131
- parallel?: {
132
- /** Unique build ID for this parallel build */
133
- nonce: string;
134
- /** The number of parallel nodes being ran */
135
- total: number;
136
- /** The index of the parallel node */
137
- index?: number;
138
- } | false | undefined;
139
- }): Promise<Config>;
140
-
141
- interface components {
142
- schemas: {
143
- /** @description SHA1 hash */
144
- Sha1Hash: string;
145
- /** @description SHA256 hash */
146
- Sha256Hash: string;
147
- /**
148
- * @description A unique identifier for the build
149
- * @example 12345
150
- */
151
- BuildId: string;
152
- /** @description Screenshot input */
153
- ScreenshotInput: {
154
- key: string;
155
- name: string;
156
- baseName?: string | null;
157
- parentName?: string | null;
158
- metadata?: {
159
- /**
160
- * @description Ignored. Can be set to get completions, validations and documentation in some editors.
161
- * @example https://api.argos-ci.com/v2/screenshot-metadata.json
162
- */
163
- $schema?: string;
164
- /** @description The URL of the page that was screenshotted */
165
- url?: string | null;
166
- /** @description An URL to an accessible preview of the screenshot */
167
- previewUrl?: string | null;
168
- viewport?: {
169
- /** @description The width of the viewport */
170
- width: number;
171
- /** @description The height of the viewport */
172
- height: number;
173
- } | null;
174
- /** @description The color scheme when the screenshot was taken */
175
- colorScheme?: ("light" | "dark") | null;
176
- /** @description The media type when the screenshot was taken */
177
- mediaType?: ("screen" | "print") | null;
178
- test?: ({
179
- /** @description The unique identifier of the test */
180
- id?: string | null;
181
- /** @description The title of the test */
182
- title: string;
183
- /** @description The path of titles leading to the test */
184
- titlePath: string[];
185
- /** @description The number of retries for the test */
186
- retries?: number | null;
187
- /** @description The current retry count */
188
- retry?: number | null;
189
- /** @description The repeat count for the test */
190
- repeat?: number | null;
191
- /** @description The location of the test in the source code */
192
- location?: {
193
- /** @description The located file */
194
- file: string;
195
- /** @description The line number in the file */
196
- line: number;
197
- /** @description The column number in the file */
198
- column: number;
199
- };
200
- /** @description Annotations associated to the test */
201
- annotations?: {
202
- /** @description The type of annotation */
203
- type: string;
204
- /** @description The description of the annotation */
205
- description?: string;
206
- /** @description The location of the annotation in the source code */
207
- location?: {
208
- /** @description The located file */
209
- file: string;
210
- /** @description The line number in the file */
211
- line: number;
212
- /** @description The column number in the file */
213
- column: number;
214
- };
215
- }[];
216
- } | null) | null;
217
- browser?: {
218
- /** @description The name of the browser */
219
- name: string;
220
- /** @description The version of the browser */
221
- version: string;
222
- } | null;
223
- /** @description The automation library that generated the screenshot */
224
- automationLibrary: {
225
- /** @description The name of the automation library */
226
- name: string;
227
- /** @description The version of the automation library */
228
- version: string;
229
- };
230
- /** @description The Argos SDK that generated the screenshot */
231
- sdk: {
232
- /** @description The name of the Argos SDK */
233
- name: string;
234
- /** @description The version of the Argos SDK */
235
- version: string;
236
- };
237
- } | null;
238
- pwTraceKey?: string | null;
239
- threshold?: number | null;
240
- /** @default image/png */
241
- contentType: string;
242
- };
243
- /** @description Build metadata */
244
- BuildMetadata: {
245
- /** @description Test suite report */
246
- testReport?: {
247
- /**
248
- * @description Status of the test suite
249
- * @enum {string}
250
- */
251
- status: "passed" | "failed" | "timedout" | "interrupted";
252
- stats?: {
253
- /** @description Date when the test suite started */
254
- startTime?: string;
255
- /** @description Duration of the test suite in milliseconds */
256
- duration?: number;
257
- };
258
- };
259
- };
260
- /** @description Build */
261
- Build: {
262
- id: components["schemas"]["BuildId"];
263
- /** @description The build number */
264
- number: number;
265
- /** @description The status of the build */
266
- status: ("accepted" | "rejected") | ("no-changes" | "changes-detected") | ("expired" | "pending" | "progress" | "error" | "aborted");
267
- /** @description The conclusion of the build */
268
- conclusion: ("no-changes" | "changes-detected") | null;
269
- /** @description Stats of the diffs present in the build */
270
- stats: {
271
- /** @description Added snapshots */
272
- added: number;
273
- /** @description Removed snapshots */
274
- removed: number;
275
- /** @description Unchanged snapshots */
276
- unchanged: number;
277
- /** @description Changed snapshots */
278
- changed: number;
279
- /** @description Ignored snapshots */
280
- ignored: number;
281
- /** @description Failure screenshots */
282
- failure: number;
283
- /** @description Retry failure screenshots */
284
- retryFailure: number;
285
- /** @description Total number of snapshots */
286
- total: number;
287
- } | null;
288
- metadata: {
289
- /** @description Test suite report */
290
- testReport?: {
291
- /**
292
- * @description Status of the test suite
293
- * @enum {string}
294
- */
295
- status: "passed" | "failed" | "timedout" | "interrupted";
296
- stats?: {
297
- /** @description Date when the test suite started */
298
- startTime?: string;
299
- /** @description Duration of the test suite in milliseconds */
300
- duration?: number;
301
- };
302
- };
303
- } | null;
304
- /**
305
- * Format: uri
306
- * @description The URL of the build
307
- */
308
- url: string;
309
- /** @description The notification payload for the build */
310
- notification: {
311
- description: string;
312
- context: string;
313
- github: {
314
- /** @enum {string} */
315
- state: "pending" | "success" | "error" | "failure";
316
- };
317
- gitlab: {
318
- /** @enum {string} */
319
- state: "pending" | "running" | "success" | "failed" | "canceled";
320
- };
321
- } | null;
322
- };
323
- /** @description Error response */
324
- Error: {
325
- error: string;
326
- details?: {
327
- message: string;
328
- }[];
329
- };
330
- /** @description Page information */
331
- PageInfo: {
332
- /** @description Total number of items */
333
- total: number;
334
- /** @description Current page number */
335
- page: number;
336
- /** @description Number of items per page */
337
- perPage: number;
338
- };
339
- /** @description Snapshot diff */
340
- SnapshotDiff: {
341
- /** @description Unique identifier of the snapshot diff */
342
- id: string;
343
- /** @description Name of the snapshot diff */
344
- name: string;
345
- /**
346
- * @description Status of the snapshot diff
347
- * @enum {string}
348
- */
349
- status: "pending" | "removed" | "failure" | "added" | "changed" | "unchanged" | "retryFailure" | "ignored";
350
- /** @description Similarity score between snapshots */
351
- score: number | null;
352
- /** @description Grouping key for the snapshot diff */
353
- group: string | null;
354
- /** @description Parent name of the snapshot (usually the story id) */
355
- parentName: string | null;
356
- /** @description URL of the diff image */
357
- url: string | null;
358
- base: {
359
- /** @description Unique identifier of the snapshot */
360
- id: string;
361
- /** @description Name of the snapshot */
362
- name: string;
363
- metadata: {
364
- /**
365
- * @description Ignored. Can be set to get completions, validations and documentation in some editors.
366
- * @example https://api.argos-ci.com/v2/screenshot-metadata.json
367
- */
368
- $schema?: string;
369
- /** @description The URL of the page that was screenshotted */
370
- url?: string | null;
371
- /** @description An URL to an accessible preview of the screenshot */
372
- previewUrl?: string | null;
373
- viewport?: {
374
- /** @description The width of the viewport */
375
- width: number;
376
- /** @description The height of the viewport */
377
- height: number;
378
- } | null;
379
- /** @description The color scheme when the screenshot was taken */
380
- colorScheme?: ("light" | "dark") | null;
381
- /** @description The media type when the screenshot was taken */
382
- mediaType?: ("screen" | "print") | null;
383
- test?: ({
384
- /** @description The unique identifier of the test */
385
- id?: string | null;
386
- /** @description The title of the test */
387
- title: string;
388
- /** @description The path of titles leading to the test */
389
- titlePath: string[];
390
- /** @description The number of retries for the test */
391
- retries?: number | null;
392
- /** @description The current retry count */
393
- retry?: number | null;
394
- /** @description The repeat count for the test */
395
- repeat?: number | null;
396
- /** @description The location of the test in the source code */
397
- location?: {
398
- /** @description The located file */
399
- file: string;
400
- /** @description The line number in the file */
401
- line: number;
402
- /** @description The column number in the file */
403
- column: number;
404
- };
405
- /** @description Annotations associated to the test */
406
- annotations?: {
407
- /** @description The type of annotation */
408
- type: string;
409
- /** @description The description of the annotation */
410
- description?: string;
411
- /** @description The location of the annotation in the source code */
412
- location?: {
413
- /** @description The located file */
414
- file: string;
415
- /** @description The line number in the file */
416
- line: number;
417
- /** @description The column number in the file */
418
- column: number;
419
- };
420
- }[];
421
- } | null) | null;
422
- browser?: {
423
- /** @description The name of the browser */
424
- name: string;
425
- /** @description The version of the browser */
426
- version: string;
427
- } | null;
428
- /** @description The automation library that generated the screenshot */
429
- automationLibrary: {
430
- /** @description The name of the automation library */
431
- name: string;
432
- /** @description The version of the automation library */
433
- version: string;
434
- };
435
- /** @description The Argos SDK that generated the screenshot */
436
- sdk: {
437
- /** @description The name of the Argos SDK */
438
- name: string;
439
- /** @description The version of the Argos SDK */
440
- version: string;
441
- };
442
- } | null;
443
- /** @description Width of the screenshot in pixels */
444
- width: number | null;
445
- /** @description Height of the screenshot in pixels */
446
- height: number | null;
447
- /**
448
- * Format: uri
449
- * @description Public URL of the snapshot
450
- */
451
- url: string;
452
- /** @description Content type of the snapshot file */
453
- contentType: string;
454
- } | null;
455
- head: {
456
- /** @description Unique identifier of the snapshot */
457
- id: string;
458
- /** @description Name of the snapshot */
459
- name: string;
460
- metadata: {
461
- /**
462
- * @description Ignored. Can be set to get completions, validations and documentation in some editors.
463
- * @example https://api.argos-ci.com/v2/screenshot-metadata.json
464
- */
465
- $schema?: string;
466
- /** @description The URL of the page that was screenshotted */
467
- url?: string | null;
468
- /** @description An URL to an accessible preview of the screenshot */
469
- previewUrl?: string | null;
470
- viewport?: {
471
- /** @description The width of the viewport */
472
- width: number;
473
- /** @description The height of the viewport */
474
- height: number;
475
- } | null;
476
- /** @description The color scheme when the screenshot was taken */
477
- colorScheme?: ("light" | "dark") | null;
478
- /** @description The media type when the screenshot was taken */
479
- mediaType?: ("screen" | "print") | null;
480
- test?: ({
481
- /** @description The unique identifier of the test */
482
- id?: string | null;
483
- /** @description The title of the test */
484
- title: string;
485
- /** @description The path of titles leading to the test */
486
- titlePath: string[];
487
- /** @description The number of retries for the test */
488
- retries?: number | null;
489
- /** @description The current retry count */
490
- retry?: number | null;
491
- /** @description The repeat count for the test */
492
- repeat?: number | null;
493
- /** @description The location of the test in the source code */
494
- location?: {
495
- /** @description The located file */
496
- file: string;
497
- /** @description The line number in the file */
498
- line: number;
499
- /** @description The column number in the file */
500
- column: number;
501
- };
502
- /** @description Annotations associated to the test */
503
- annotations?: {
504
- /** @description The type of annotation */
505
- type: string;
506
- /** @description The description of the annotation */
507
- description?: string;
508
- /** @description The location of the annotation in the source code */
509
- location?: {
510
- /** @description The located file */
511
- file: string;
512
- /** @description The line number in the file */
513
- line: number;
514
- /** @description The column number in the file */
515
- column: number;
516
- };
517
- }[];
518
- } | null) | null;
519
- browser?: {
520
- /** @description The name of the browser */
521
- name: string;
522
- /** @description The version of the browser */
523
- version: string;
524
- } | null;
525
- /** @description The automation library that generated the screenshot */
526
- automationLibrary: {
527
- /** @description The name of the automation library */
528
- name: string;
529
- /** @description The version of the automation library */
530
- version: string;
531
- };
532
- /** @description The Argos SDK that generated the screenshot */
533
- sdk: {
534
- /** @description The name of the Argos SDK */
535
- name: string;
536
- /** @description The version of the Argos SDK */
537
- version: string;
538
- };
539
- } | null;
540
- /** @description Width of the screenshot in pixels */
541
- width: number | null;
542
- /** @description Height of the screenshot in pixels */
543
- height: number | null;
544
- /**
545
- * Format: uri
546
- * @description Public URL of the snapshot
547
- */
548
- url: string;
549
- /** @description Content type of the snapshot file */
550
- contentType: string;
551
- } | null;
552
- };
553
- /** @description Project */
554
- Project: {
555
- id: string;
556
- defaultBaseBranch: string;
557
- hasRemoteContentAccess: boolean;
558
- };
559
- };
560
- responses: never;
561
- parameters: never;
562
- requestBodies: never;
563
- headers: never;
564
- pathItems: never;
565
- }
566
-
567
- type FinalizeParameters = {
568
- parallel?: {
569
- nonce: string;
570
- };
571
- };
572
- /**
573
- * Finalize pending builds.
574
- */
575
- declare function finalize(params: FinalizeParameters): Promise<{
576
- builds: components["schemas"]["Build"][];
577
- }>;
578
-
579
- type BuildMetadata = ArgosAPISchema.components["schemas"]["BuildMetadata"];
580
- interface UploadParameters {
581
- /**
582
- * Globs that match image file paths to upload.
583
- */
584
- files?: string[];
585
- /**
586
- * Root directory used to resolve image paths.
587
- * @default process.cwd()
588
- */
589
- root?: string;
590
- /**
591
- * Globs that match image file paths to exclude from upload.
592
- * @default ["**\/*.{png,jpg,jpeg}"]
593
- */
594
- ignore?: string[];
595
- /**
596
- * Base URL of the Argos API.
597
- * @default "https://api.argos-ci.com/v2/"
598
- */
599
- apiBaseUrl?: string;
600
- /**
601
- * Git commit SHA of the build.
602
- */
603
- commit?: string;
604
- /**
605
- * Git branch name of the build.
606
- */
607
- branch?: string;
608
- /**
609
- * Argos repository access token.
610
- */
611
- token?: string;
612
- /**
613
- * Pull request number associated with the build.
614
- */
615
- prNumber?: number;
616
- /**
617
- * Custom build name. Useful when triggering multiple Argos builds
618
- * for the same commit.
619
- */
620
- buildName?: string;
621
- /**
622
- * Build mode to use.
623
- * - "ci": Review the visual changes introduced by a feature branch and prevent regressions.
624
- * - "monitoring": Track visual changes outside the standard CI flow, either on a schedule or before a release.
625
- * @see https://argos-ci.com/docs/build-modes
626
- * @default "ci"
627
- */
628
- mode?: "ci" | "monitoring";
629
- /**
630
- * Parallel test suite configuration.
631
- * @default false
632
- */
633
- parallel?: {
634
- /** Unique build identifier shared across parallel jobs. */
635
- nonce: string;
636
- /** Total number of parallel jobs, set to -1 to finalize manually. */
637
- total: number;
638
- /** Index of the current job (must start from 1). */
639
- index?: number;
640
- } | false;
641
- /**
642
- * Branch used as the baseline for screenshot comparison.
643
- */
644
- referenceBranch?: string;
645
- /**
646
- * Commit SHA used as the baseline for screenshot comparison.
647
- */
648
- referenceCommit?: string;
649
- /**
650
- * Diff sensitivity threshold between 0 and 1.
651
- * Higher values make Argos less sensitive to differences.
652
- * @default 0.5
653
- */
654
- threshold?: number;
655
- /**
656
- * Additional build metadata.
657
- */
658
- metadata?: BuildMetadata;
659
- /**
660
- * Preview URL configuration.
661
- * Can be a fixed base URL or a function to transform URLs dynamically.
662
- */
663
- previewUrl?: {
664
- baseUrl: string;
665
- } | ((url: string) => string);
666
- /**
667
- * Whether this build contains only a subset of screenshots.
668
- * This is useful when a build is created from an incomplete test suite where some tests are skipped.
669
- * @default false
670
- */
671
- subset?: boolean;
672
- }
673
- interface Screenshot {
674
- hash: string;
675
- optimizedPath: string;
676
- metadata: ScreenshotMetadata | null;
677
- threshold: number | null;
678
- baseName: string | null;
679
- pwTrace: {
680
- path: string;
681
- hash: string;
682
- } | null;
683
- name: string;
684
- path: string;
685
- }
686
- /**
687
- * Upload screenshots to Argos.
688
- */
689
- declare function upload(params: UploadParameters): Promise<{
690
- build: ArgosAPISchema.components["schemas"]["Build"];
691
- screenshots: Screenshot[];
692
- }>;
693
-
694
- type SkipParameters = Pick<UploadParameters, "apiBaseUrl" | "commit" | "branch" | "token" | "prNumber" | "buildName" | "metadata">;
695
- /**
696
- * Mark a build as skipped.
697
- */
698
- declare function skip(params: SkipParameters): Promise<{
699
- build: ArgosAPISchema.components["schemas"]["Build"];
700
- }>;
701
-
702
- export { type Config, type FinalizeParameters, type UploadParameters, finalize, getConfigFromOptions, readConfig, skip, upload };