qase-javascript-commons 2.6.2 → 2.6.4
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/changelog.md +47 -0
- package/dist/client/clientV1.d.ts +6 -83
- package/dist/client/clientV1.js +15 -549
- package/dist/client/clientV2.d.ts +6 -24
- package/dist/client/clientV2.js +8 -255
- package/dist/client/services/api-error-handler.d.ts +10 -0
- package/dist/client/services/api-error-handler.js +44 -0
- package/dist/client/services/attachment-service.d.ts +16 -0
- package/dist/client/services/attachment-service.js +209 -0
- package/dist/client/services/configuration-service.d.ts +12 -0
- package/dist/client/services/configuration-service.js +110 -0
- package/dist/client/services/result-transformer.d.ts +23 -0
- package/dist/client/services/result-transformer.js +188 -0
- package/dist/client/services/run-service.d.ts +17 -0
- package/dist/client/services/run-service.js +114 -0
- package/dist/client/transport/api-config-builder.d.ts +8 -0
- package/dist/client/transport/api-config-builder.js +96 -0
- package/dist/formatter/index.d.ts +1 -0
- package/dist/formatter/index.js +3 -1
- package/dist/formatter/report-serializer.d.ts +20 -0
- package/dist/formatter/report-serializer.js +89 -0
- package/dist/qase/options-resolver.d.ts +19 -0
- package/dist/qase/options-resolver.js +47 -0
- package/dist/qase/reporter-factory.d.ts +19 -0
- package/dist/qase/reporter-factory.js +67 -0
- package/dist/qase/status-processor.d.ts +17 -0
- package/dist/qase/status-processor.js +48 -0
- package/dist/qase.d.ts +17 -85
- package/dist/qase.js +133 -415
- package/dist/reporters/report-reporter.d.ts +4 -35
- package/dist/reporters/report-reporter.js +6 -130
- package/dist/reporters/shared/fallback-coordinator.d.ts +47 -0
- package/dist/reporters/shared/fallback-coordinator.js +119 -0
- package/dist/reporters/shared/testops-constants.d.ts +5 -0
- package/dist/reporters/shared/testops-constants.js +8 -0
- package/dist/reporters/shared/testops-url.d.ts +9 -0
- package/dist/reporters/shared/testops-url.js +17 -0
- package/dist/reporters/testops-multi-reporter.d.ts +0 -1
- package/dist/reporters/testops-multi-reporter.js +4 -9
- package/dist/reporters/testops-reporter.d.ts +0 -6
- package/dist/reporters/testops-reporter.js +7 -17
- package/dist/utils/token-masker.d.ts +11 -0
- package/dist/utils/token-masker.js +26 -0
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,3 +1,50 @@
|
|
|
1
|
+
# qase-javascript-commons@2.6.3
|
|
2
|
+
|
|
3
|
+
## Internal refactoring
|
|
4
|
+
|
|
5
|
+
The `QaseReporter` God class (~680 lines) has been split into focused components,
|
|
6
|
+
and spec-compliant report serialization has been extracted into its own module.
|
|
7
|
+
**The public API is unchanged** — all exports, method signatures, option shapes,
|
|
8
|
+
environment variables, and the JSON report format are preserved verbatim. The
|
|
9
|
+
report format is additionally verified in CI against the official Qase report
|
|
10
|
+
schemas via `reporters-validator`.
|
|
11
|
+
|
|
12
|
+
New internal components:
|
|
13
|
+
|
|
14
|
+
- `src/qase/options-resolver.ts` — env + config composition, state restore,
|
|
15
|
+
`withState` detection.
|
|
16
|
+
- `src/qase/reporter-factory.ts` — mode-based reporter instantiation with
|
|
17
|
+
option validation (replaces the inline `switch` that previously lived inside
|
|
18
|
+
`QaseReporter.createReporter`).
|
|
19
|
+
- `src/qase/status-processor.ts` — status mapping + filtering.
|
|
20
|
+
- `src/reporters/shared/fallback-coordinator.ts` — encapsulates the
|
|
21
|
+
upstream → fallback → disabled cascade that was previously repeated in five
|
|
22
|
+
lifecycle methods of `QaseReporter`.
|
|
23
|
+
- `src/utils/token-masker.ts` — reusable `maskToken` / `sanitizeOptionsForLog`.
|
|
24
|
+
- `src/formatter/report-serializer.ts` — pure spec-compliant serializer
|
|
25
|
+
(RSLT-01/02, STEP-01/02/03 rules), lifted out of `ReportReporter`.
|
|
26
|
+
|
|
27
|
+
Shared utilities:
|
|
28
|
+
|
|
29
|
+
- `DEFAULT_BATCH_SIZE` constant and `resolveTestOpsBaseUrl` helper now live
|
|
30
|
+
in `src/reporters/shared/` (previously duplicated between `TestOpsReporter`
|
|
31
|
+
and `TestOpsMultiReporter`).
|
|
32
|
+
|
|
33
|
+
## Bug fixes
|
|
34
|
+
|
|
35
|
+
- **Fallback activation on upstream creation failure.** Previously, if the
|
|
36
|
+
upstream reporter failed to construct (for example, misconfigured TestOps
|
|
37
|
+
client) and a `fallback` mode was configured, the reporter would disable
|
|
38
|
+
itself instead of switching to the fallback. Now the fallback is correctly
|
|
39
|
+
activated. **Note for users:** pipelines with a broken upstream
|
|
40
|
+
configuration and a `report` fallback will now start producing local report
|
|
41
|
+
artifacts where previously nothing was produced.
|
|
42
|
+
- `publish()` no longer double-calls both reporters when already in fallback
|
|
43
|
+
mode — it now runs exactly one reporter.
|
|
44
|
+
- `StateManager.setMode(off)` on fallback failure now respects the
|
|
45
|
+
`withState` flag, so frameworks that don't use persistent state no longer
|
|
46
|
+
write state during shutdown.
|
|
47
|
+
|
|
1
48
|
# qase-javascript-commons@2.6.2
|
|
2
49
|
|
|
3
50
|
## Bug fixes
|
|
@@ -1,96 +1,19 @@
|
|
|
1
1
|
import { Attachment, TestResultType } from '../models';
|
|
2
2
|
import { TestOpsOptionsType } from '../models/config/TestOpsOptionsType';
|
|
3
|
-
import { QaseError } from '../utils/qase-error';
|
|
4
|
-
import { IClient } from './interface';
|
|
5
3
|
import { LoggerInterface } from '../utils/logger';
|
|
4
|
+
import { IClient } from './interface';
|
|
5
|
+
import { AttachmentService } from './services/attachment-service';
|
|
6
|
+
import { RunService } from './services/run-service';
|
|
6
7
|
export declare class ClientV1 implements IClient {
|
|
7
8
|
protected readonly logger: LoggerInterface;
|
|
8
9
|
protected readonly config: TestOpsOptionsType;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
private readonly environmentClient;
|
|
13
|
-
private readonly attachmentClient;
|
|
14
|
-
private readonly configurationClient;
|
|
10
|
+
protected readonly environment: string | undefined;
|
|
11
|
+
protected readonly attachmentService: AttachmentService;
|
|
12
|
+
protected readonly runService: RunService;
|
|
15
13
|
constructor(logger: LoggerInterface, config: TestOpsOptionsType, environment: string | undefined);
|
|
16
|
-
private createApiConfig;
|
|
17
14
|
uploadResults(_runId: number, _results: TestResultType[]): Promise<void>;
|
|
18
15
|
createRun(): Promise<number>;
|
|
19
16
|
completeRun(runId: number): Promise<void>;
|
|
20
17
|
enablePublicReport(runId: number): Promise<void>;
|
|
21
|
-
private getErrorMessage;
|
|
22
18
|
uploadAttachment(attachment: Attachment): Promise<string>;
|
|
23
|
-
protected uploadAttachments(attachments: Attachment[]): Promise<string[]>;
|
|
24
|
-
/**
|
|
25
|
-
* Group attachments into batches respecting API limits:
|
|
26
|
-
* - Up to 20 files per batch
|
|
27
|
-
* - Up to 128 MB per batch
|
|
28
|
-
* @param attachments Array of attachments to group
|
|
29
|
-
* @returns Array of attachment batches
|
|
30
|
-
*/
|
|
31
|
-
private groupAttachmentsIntoBatches;
|
|
32
|
-
/**
|
|
33
|
-
* Upload attachment with retry logic for 429 errors
|
|
34
|
-
* @param project Project code
|
|
35
|
-
* @param data Attachment data array (can contain multiple files)
|
|
36
|
-
* @param attachmentNames Attachment names for logging (comma-separated for batches)
|
|
37
|
-
* @param maxRetries Maximum number of retry attempts
|
|
38
|
-
* @param initialDelay Initial delay in milliseconds
|
|
39
|
-
* @returns Promise with upload response
|
|
40
|
-
*/
|
|
41
|
-
private uploadAttachmentWithRetry;
|
|
42
|
-
/**
|
|
43
|
-
* Extract Retry-After header value from response or return null
|
|
44
|
-
* @param error Axios error
|
|
45
|
-
* @returns Retry-After value in milliseconds or null
|
|
46
|
-
*/
|
|
47
|
-
private getRetryAfter;
|
|
48
|
-
/**
|
|
49
|
-
* Delay execution for specified milliseconds
|
|
50
|
-
* @param ms Milliseconds to delay
|
|
51
|
-
*/
|
|
52
|
-
private delay;
|
|
53
|
-
/**
|
|
54
|
-
* Ensure attachment size is calculated if not set or is 0
|
|
55
|
-
* @param attachment Attachment to ensure size for
|
|
56
|
-
*/
|
|
57
|
-
private ensureAttachmentSize;
|
|
58
|
-
private prepareAttachmentData;
|
|
59
|
-
private getEnvironmentId;
|
|
60
|
-
private prepareRunObject;
|
|
61
|
-
/**
|
|
62
|
-
* Get all configuration groups with their configurations
|
|
63
|
-
* @returns Promise<ConfigurationGroup[]> Array of configuration groups
|
|
64
|
-
* @private
|
|
65
|
-
*/
|
|
66
|
-
private getConfigurations;
|
|
67
|
-
/**
|
|
68
|
-
* Create a configuration group
|
|
69
|
-
* @param title Group title
|
|
70
|
-
* @returns Promise<number | undefined> Created group ID
|
|
71
|
-
* @private
|
|
72
|
-
*/
|
|
73
|
-
private createConfigurationGroup;
|
|
74
|
-
/**
|
|
75
|
-
* Create a configuration in a group
|
|
76
|
-
* @param title Configuration title
|
|
77
|
-
* @param groupId Group ID
|
|
78
|
-
* @returns Promise<number | undefined> Created configuration ID
|
|
79
|
-
* @private
|
|
80
|
-
*/
|
|
81
|
-
private createConfiguration;
|
|
82
|
-
/**
|
|
83
|
-
* Handle configuration creation based on config settings
|
|
84
|
-
* @returns Promise<number[]> Array of configuration IDs
|
|
85
|
-
* @private
|
|
86
|
-
*/
|
|
87
|
-
private handleConfigurations;
|
|
88
|
-
/**
|
|
89
|
-
* Process error and throw QaseError
|
|
90
|
-
* @param {Error | AxiosError} error
|
|
91
|
-
* @param {string} message
|
|
92
|
-
* @param {object} model
|
|
93
|
-
* @private
|
|
94
|
-
*/
|
|
95
|
-
protected processError(error: unknown, message: string, model?: object): QaseError;
|
|
96
19
|
}
|