@dvl-software/eip-cypress 0.0.0-stage → 0.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.
@@ -0,0 +1,73 @@
1
+ /** Plugin settings, from the environment of the CI job (never from the spec files). */
2
+ interface PluginOptions {
3
+ apiKey?: string;
4
+ apiUrl?: string;
5
+ projectId?: string;
6
+ rerunOf?: number;
7
+ environment?: string;
8
+ runName?: string;
9
+ /** Regular expression: app requests whose URL matches are not recorded (e.g. streaming endpoints). */
10
+ captureExclude?: string;
11
+ /** Allows a plain-http EIP_API_URL that isn't localhost. */
12
+ allowHttp: boolean;
13
+ disabled: boolean;
14
+ /** Parallel runs: containers with the same build id (and group) report into one run. */
15
+ buildId?: string;
16
+ group?: string;
17
+ totalMachines?: number;
18
+ /** Specs per Cypress start in a parallel run. */
19
+ batch: number;
20
+ /** Set by `eip-cypress run --parallel` for the Cypress processes it starts. */
21
+ machineId?: string;
22
+ parallelSeed: boolean;
23
+ parallelStateFile?: string;
24
+ /** The user's own `--spec`, which the CLI moves here so the first container can send the matching specs. */
25
+ parallelSpec?: string;
26
+ }
27
+
28
+ /** One cleaning pass; {@link count} tells how many values were removed. */
29
+ declare class Redaction {
30
+ count: number;
31
+ private readonly extraFields;
32
+ private readonly extraPatterns;
33
+ constructor(extraFields?: string[], extraPatterns?: string[]);
34
+ isSecretField(name: string): boolean;
35
+ headers(headers: unknown): unknown;
36
+ body(body: unknown): unknown;
37
+ private stringBody;
38
+ private pairs;
39
+ /** User info, base through the value patterns, query and a `k=v` fragment through the pair rules. */
40
+ url(url: string): string;
41
+ /** URLs in the text (through {@link url}), then `"secret": "…"` pairs, then the value patterns. */
42
+ text(text: string): string;
43
+ /** The value patterns only: bearer, JWT, email, IBAN, card, phone, own patterns. */
44
+ plain(text: string): string;
45
+ private replace;
46
+ }
47
+
48
+ /** A file path as a literal glob (Cypress resolves specPattern with fast-glob). */
49
+ declare function escapeGlob(path: string): string;
50
+
51
+ /** Your own handlers for events the plugin uses: Cypress keeps only one handler per event, so pass them here. */
52
+ interface EipHooks {
53
+ beforeRun?: (details: Cypress.BeforeRunDetails) => unknown | Promise<unknown>;
54
+ afterSpec?: (spec: Cypress.Spec, results: CypressCommandLine.RunResult) => unknown | Promise<unknown>;
55
+ afterRun?: (results: CypressCommandLine.CypressRunResult | CypressCommandLine.CypressFailedRunResult) => unknown | Promise<unknown>;
56
+ }
57
+ interface SetupOptions extends Partial<PluginOptions> {
58
+ hooks?: EipHooks;
59
+ }
60
+ /**
61
+ * Sends this Cypress run to EIP. Call it from `setupNodeEvents` and return its result:
62
+ *
63
+ * ```ts
64
+ * setupNodeEvents(on, config) { return setupEip(on, config); }
65
+ * ```
66
+ *
67
+ * Reads `EIP_API_KEY`, `EIP_API_URL`, `EIP_PROJECT_ID` (and `EIP_RERUN_OF` for a re-run) from the environment.
68
+ * Without a key it does nothing. It never changes the outcome of the Cypress run.
69
+ */
70
+ declare function setupEip(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions, options?: SetupOptions): Promise<Cypress.PluginConfigOptions>;
71
+ declare function hhmmss(ms: number): string;
72
+
73
+ export { type EipHooks, type PluginOptions, Redaction, type SetupOptions, escapeGlob, hhmmss, setupEip };
@@ -0,0 +1,73 @@
1
+ /** Plugin settings, from the environment of the CI job (never from the spec files). */
2
+ interface PluginOptions {
3
+ apiKey?: string;
4
+ apiUrl?: string;
5
+ projectId?: string;
6
+ rerunOf?: number;
7
+ environment?: string;
8
+ runName?: string;
9
+ /** Regular expression: app requests whose URL matches are not recorded (e.g. streaming endpoints). */
10
+ captureExclude?: string;
11
+ /** Allows a plain-http EIP_API_URL that isn't localhost. */
12
+ allowHttp: boolean;
13
+ disabled: boolean;
14
+ /** Parallel runs: containers with the same build id (and group) report into one run. */
15
+ buildId?: string;
16
+ group?: string;
17
+ totalMachines?: number;
18
+ /** Specs per Cypress start in a parallel run. */
19
+ batch: number;
20
+ /** Set by `eip-cypress run --parallel` for the Cypress processes it starts. */
21
+ machineId?: string;
22
+ parallelSeed: boolean;
23
+ parallelStateFile?: string;
24
+ /** The user's own `--spec`, which the CLI moves here so the first container can send the matching specs. */
25
+ parallelSpec?: string;
26
+ }
27
+
28
+ /** One cleaning pass; {@link count} tells how many values were removed. */
29
+ declare class Redaction {
30
+ count: number;
31
+ private readonly extraFields;
32
+ private readonly extraPatterns;
33
+ constructor(extraFields?: string[], extraPatterns?: string[]);
34
+ isSecretField(name: string): boolean;
35
+ headers(headers: unknown): unknown;
36
+ body(body: unknown): unknown;
37
+ private stringBody;
38
+ private pairs;
39
+ /** User info, base through the value patterns, query and a `k=v` fragment through the pair rules. */
40
+ url(url: string): string;
41
+ /** URLs in the text (through {@link url}), then `"secret": "…"` pairs, then the value patterns. */
42
+ text(text: string): string;
43
+ /** The value patterns only: bearer, JWT, email, IBAN, card, phone, own patterns. */
44
+ plain(text: string): string;
45
+ private replace;
46
+ }
47
+
48
+ /** A file path as a literal glob (Cypress resolves specPattern with fast-glob). */
49
+ declare function escapeGlob(path: string): string;
50
+
51
+ /** Your own handlers for events the plugin uses: Cypress keeps only one handler per event, so pass them here. */
52
+ interface EipHooks {
53
+ beforeRun?: (details: Cypress.BeforeRunDetails) => unknown | Promise<unknown>;
54
+ afterSpec?: (spec: Cypress.Spec, results: CypressCommandLine.RunResult) => unknown | Promise<unknown>;
55
+ afterRun?: (results: CypressCommandLine.CypressRunResult | CypressCommandLine.CypressFailedRunResult) => unknown | Promise<unknown>;
56
+ }
57
+ interface SetupOptions extends Partial<PluginOptions> {
58
+ hooks?: EipHooks;
59
+ }
60
+ /**
61
+ * Sends this Cypress run to EIP. Call it from `setupNodeEvents` and return its result:
62
+ *
63
+ * ```ts
64
+ * setupNodeEvents(on, config) { return setupEip(on, config); }
65
+ * ```
66
+ *
67
+ * Reads `EIP_API_KEY`, `EIP_API_URL`, `EIP_PROJECT_ID` (and `EIP_RERUN_OF` for a re-run) from the environment.
68
+ * Without a key it does nothing. It never changes the outcome of the Cypress run.
69
+ */
70
+ declare function setupEip(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions, options?: SetupOptions): Promise<Cypress.PluginConfigOptions>;
71
+ declare function hhmmss(ms: number): string;
72
+
73
+ export { type EipHooks, type PluginOptions, Redaction, type SetupOptions, escapeGlob, hhmmss, setupEip };