@tiden/reporter-commons 0.1.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/CHANGELOG.md +25 -0
- package/LICENSE +201 -0
- package/README.md +34 -0
- package/dist/client/interface.d.ts +8 -0
- package/dist/client/interface.js +2 -0
- package/dist/client/reporter-api-models.d.ts +96 -0
- package/dist/client/reporter-api-models.js +2 -0
- package/dist/client/reporter-api.d.ts +14 -0
- package/dist/client/reporter-api.js +25 -0
- 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 +29 -0
- package/dist/client/services/attachment-service.js +268 -0
- package/dist/client/services/result-transformer.d.ts +21 -0
- package/dist/client/services/result-transformer.js +180 -0
- package/dist/client/services/run-service.d.ts +20 -0
- package/dist/client/services/run-service.js +68 -0
- package/dist/client/tiden-client.d.ts +34 -0
- package/dist/client/tiden-client.js +99 -0
- package/dist/client/tiden-http.d.ts +11 -0
- package/dist/client/tiden-http.js +23 -0
- package/dist/config/config-loader-interface.d.ts +4 -0
- package/dist/config/config-loader-interface.js +2 -0
- package/dist/config/config-loader.d.ts +10 -0
- package/dist/config/config-loader.js +60 -0
- package/dist/config/config-type.d.ts +2 -0
- package/dist/config/config-type.js +2 -0
- package/dist/config/config-validation-schema.d.ts +212 -0
- package/dist/config/config-validation-schema.js +213 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/index.js +7 -0
- package/dist/core/options-resolver.d.ts +19 -0
- package/dist/core/options-resolver.js +47 -0
- package/dist/core/reporter-factory.d.ts +18 -0
- package/dist/core/reporter-factory.js +63 -0
- package/dist/core/status-processor.d.ts +17 -0
- package/dist/core/status-processor.js +48 -0
- package/dist/env/env-enum.d.ts +64 -0
- package/dist/env/env-enum.js +75 -0
- package/dist/env/env-to-config.d.ts +7 -0
- package/dist/env/env-to-config.js +60 -0
- package/dist/env/env-type.d.ts +29 -0
- package/dist/env/env-type.js +3 -0
- package/dist/env/env-validation-schema.d.ts +6 -0
- package/dist/env/env-validation-schema.js +113 -0
- package/dist/env/index.d.ts +4 -0
- package/dist/env/index.js +13 -0
- package/dist/formatter/formatter-interface.d.ts +3 -0
- package/dist/formatter/formatter-interface.js +2 -0
- package/dist/formatter/index.d.ts +4 -0
- package/dist/formatter/index.js +9 -0
- package/dist/formatter/json-formatter.d.ts +13 -0
- package/dist/formatter/json-formatter.js +28 -0
- package/dist/formatter/jsonp-formatter.d.ts +13 -0
- package/dist/formatter/jsonp-formatter.js +29 -0
- package/dist/formatter/report-serializer.d.ts +20 -0
- package/dist/formatter/report-serializer.js +92 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +30 -0
- package/dist/internal/filter-positive-ids.d.ts +17 -0
- package/dist/internal/filter-positive-ids.js +38 -0
- package/dist/internal/ids-parser.d.ts +9 -0
- package/dist/internal/ids-parser.js +21 -0
- package/dist/internal/index.d.ts +8 -0
- package/dist/internal/index.js +15 -0
- package/dist/internal/step-parser.d.ts +11 -0
- package/dist/internal/step-parser.js +28 -0
- package/dist/internal/suite-file.d.ts +13 -0
- package/dist/internal/suite-file.js +16 -0
- package/dist/internal/suite-normalizer.d.ts +6 -0
- package/dist/internal/suite-normalizer.js +11 -0
- package/dist/internal/title.d.ts +5 -0
- package/dist/internal/title.js +15 -0
- package/dist/models/attachment.d.ts +8 -0
- package/dist/models/attachment.js +2 -0
- package/dist/models/config/TidenOptionsType.d.ts +33 -0
- package/dist/models/config/TidenOptionsType.js +2 -0
- package/dist/models/configuration.d.ts +12 -0
- package/dist/models/configuration.js +2 -0
- package/dist/models/error.d.ts +7 -0
- package/dist/models/error.js +24 -0
- package/dist/models/execution-sum.d.ts +6 -0
- package/dist/models/execution-sum.js +2 -0
- package/dist/models/host-data.d.ts +12 -0
- package/dist/models/host-data.js +2 -0
- package/dist/models/index.d.ts +11 -0
- package/dist/models/index.js +15 -0
- package/dist/models/report.d.ts +14 -0
- package/dist/models/report.js +2 -0
- package/dist/models/short-result.d.ts +7 -0
- package/dist/models/short-result.js +2 -0
- package/dist/models/stats.d.ts +9 -0
- package/dist/models/stats.js +2 -0
- package/dist/models/step-data.d.ts +19 -0
- package/dist/models/step-data.js +2 -0
- package/dist/models/step-execution.d.ts +13 -0
- package/dist/models/step-execution.js +23 -0
- package/dist/models/test-execution.d.ts +20 -0
- package/dist/models/test-execution.js +32 -0
- package/dist/models/test-result.d.ts +44 -0
- package/dist/models/test-result.js +50 -0
- package/dist/models/test-step.d.ts +18 -0
- package/dist/models/test-step.js +53 -0
- package/dist/options/composeOptions.d.ts +8 -0
- package/dist/options/composeOptions.js +12 -0
- package/dist/options/index.d.ts +3 -0
- package/dist/options/index.js +7 -0
- package/dist/options/mode-enum.d.ts +8 -0
- package/dist/options/mode-enum.js +12 -0
- package/dist/options/options-type.d.ts +38 -0
- package/dist/options/options-type.js +3 -0
- package/dist/profilers/abstract-profiler.d.ts +5 -0
- package/dist/profilers/abstract-profiler.js +6 -0
- package/dist/profilers/fetch-interceptor.d.ts +60 -0
- package/dist/profilers/fetch-interceptor.js +277 -0
- package/dist/profilers/http-interceptor.d.ts +76 -0
- package/dist/profilers/http-interceptor.js +252 -0
- package/dist/profilers/index.d.ts +5 -0
- package/dist/profilers/index.js +11 -0
- package/dist/profilers/network-profiler.d.ts +61 -0
- package/dist/profilers/network-profiler.js +94 -0
- package/dist/reporters/abstract-reporter.d.ts +68 -0
- package/dist/reporters/abstract-reporter.js +78 -0
- package/dist/reporters/index.d.ts +3 -0
- package/dist/reporters/index.js +9 -0
- package/dist/reporters/report-reporter.d.ts +50 -0
- package/dist/reporters/report-reporter.js +167 -0
- package/dist/reporters/run-reporter.d.ts +65 -0
- package/dist/reporters/run-reporter.js +155 -0
- package/dist/reporters/shared/fallback-coordinator.d.ts +47 -0
- package/dist/reporters/shared/fallback-coordinator.js +119 -0
- package/dist/reporters/shared/run-constants.d.ts +11 -0
- package/dist/reporters/shared/run-constants.js +14 -0
- package/dist/state/state.d.ts +16 -0
- package/dist/state/state.js +70 -0
- package/dist/steps/step.d.ts +16 -0
- package/dist/steps/step.js +86 -0
- package/dist/tiden.d.ts +48 -0
- package/dist/tiden.js +223 -0
- package/dist/utils/disabled-exception.d.ts +6 -0
- package/dist/utils/disabled-exception.js +10 -0
- package/dist/utils/get-package-version.d.ts +5 -0
- package/dist/utils/get-package-version.js +25 -0
- package/dist/utils/hostData.d.ts +8 -0
- package/dist/utils/hostData.js +140 -0
- package/dist/utils/is-axios-error.d.ts +6 -0
- package/dist/utils/is-axios-error.js +11 -0
- package/dist/utils/logger.d.ts +33 -0
- package/dist/utils/logger.js +141 -0
- package/dist/utils/mimeTypes.d.ts +5 -0
- package/dist/utils/mimeTypes.js +50 -0
- package/dist/utils/project-mapping-utils.d.ts +17 -0
- package/dist/utils/project-mapping-utils.js +29 -0
- package/dist/utils/signature.d.ts +11 -0
- package/dist/utils/signature.js +34 -0
- package/dist/utils/status-mapping-utils.d.ts +14 -0
- package/dist/utils/status-mapping-utils.js +45 -0
- package/dist/utils/test-status-utils.d.ts +8 -0
- package/dist/utils/test-status-utils.js +152 -0
- package/dist/utils/tiden-error.d.ts +18 -0
- package/dist/utils/tiden-error.js +19 -0
- package/dist/utils/token-masker.d.ts +11 -0
- package/dist/utils/token-masker.js +26 -0
- package/dist/utils/validate-json.d.ts +20 -0
- package/dist/utils/validate-json.js +41 -0
- package/dist/writer/driver-enum.d.ts +13 -0
- package/dist/writer/driver-enum.js +18 -0
- package/dist/writer/fs-writer.d.ts +40 -0
- package/dist/writer/fs-writer.js +139 -0
- package/dist/writer/index.d.ts +3 -0
- package/dist/writer/index.js +8 -0
- package/dist/writer/writer-interface.d.ts +7 -0
- package/dist/writer/writer-interface.js +2 -0
- package/package.json +83 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface StepTextData {
|
|
2
|
+
action: string;
|
|
3
|
+
expected_result: string | null;
|
|
4
|
+
data: string | null;
|
|
5
|
+
}
|
|
6
|
+
export interface StepGherkinData {
|
|
7
|
+
keyword: string;
|
|
8
|
+
name: string;
|
|
9
|
+
line: number;
|
|
10
|
+
}
|
|
11
|
+
export interface StepRequestData {
|
|
12
|
+
request_method: string;
|
|
13
|
+
request_url: string;
|
|
14
|
+
request_headers: Record<string, string> | null;
|
|
15
|
+
request_body: string | null;
|
|
16
|
+
status_code: number | null;
|
|
17
|
+
response_body: string | null;
|
|
18
|
+
response_headers: Record<string, string> | null;
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare enum StepStatusEnum {
|
|
2
|
+
passed = "passed",
|
|
3
|
+
failed = "failed",
|
|
4
|
+
blocked = "blocked",
|
|
5
|
+
skipped = "skipped"
|
|
6
|
+
}
|
|
7
|
+
export declare class StepExecution {
|
|
8
|
+
start_time: number | null;
|
|
9
|
+
status: StepStatusEnum;
|
|
10
|
+
end_time: number | null;
|
|
11
|
+
duration: number | null;
|
|
12
|
+
constructor();
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StepExecution = exports.StepStatusEnum = void 0;
|
|
4
|
+
var StepStatusEnum;
|
|
5
|
+
(function (StepStatusEnum) {
|
|
6
|
+
StepStatusEnum["passed"] = "passed";
|
|
7
|
+
StepStatusEnum["failed"] = "failed";
|
|
8
|
+
StepStatusEnum["blocked"] = "blocked";
|
|
9
|
+
StepStatusEnum["skipped"] = "skipped";
|
|
10
|
+
})(StepStatusEnum || (exports.StepStatusEnum = StepStatusEnum = {}));
|
|
11
|
+
class StepExecution {
|
|
12
|
+
start_time;
|
|
13
|
+
status;
|
|
14
|
+
end_time;
|
|
15
|
+
duration;
|
|
16
|
+
constructor() {
|
|
17
|
+
this.status = StepStatusEnum.passed;
|
|
18
|
+
this.start_time = null;
|
|
19
|
+
this.end_time = null;
|
|
20
|
+
this.duration = null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.StepExecution = StepExecution;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @enum {string}
|
|
3
|
+
*/
|
|
4
|
+
export declare enum TestStatusEnum {
|
|
5
|
+
passed = "passed",
|
|
6
|
+
failed = "failed",
|
|
7
|
+
skipped = "skipped",
|
|
8
|
+
disabled = "disabled",
|
|
9
|
+
blocked = "blocked",
|
|
10
|
+
invalid = "invalid"
|
|
11
|
+
}
|
|
12
|
+
export declare class TestExecution {
|
|
13
|
+
start_time: number | null;
|
|
14
|
+
status: TestStatusEnum;
|
|
15
|
+
end_time: number | null;
|
|
16
|
+
duration: number | null;
|
|
17
|
+
stacktrace: string | null;
|
|
18
|
+
thread: string | null;
|
|
19
|
+
constructor();
|
|
20
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TestExecution = exports.TestStatusEnum = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @enum {string}
|
|
6
|
+
*/
|
|
7
|
+
var TestStatusEnum;
|
|
8
|
+
(function (TestStatusEnum) {
|
|
9
|
+
TestStatusEnum["passed"] = "passed";
|
|
10
|
+
TestStatusEnum["failed"] = "failed";
|
|
11
|
+
TestStatusEnum["skipped"] = "skipped";
|
|
12
|
+
TestStatusEnum["disabled"] = "disabled";
|
|
13
|
+
TestStatusEnum["blocked"] = "blocked";
|
|
14
|
+
TestStatusEnum["invalid"] = "invalid";
|
|
15
|
+
})(TestStatusEnum || (exports.TestStatusEnum = TestStatusEnum = {}));
|
|
16
|
+
class TestExecution {
|
|
17
|
+
start_time;
|
|
18
|
+
status;
|
|
19
|
+
end_time;
|
|
20
|
+
duration;
|
|
21
|
+
stacktrace;
|
|
22
|
+
thread;
|
|
23
|
+
constructor() {
|
|
24
|
+
this.status = TestStatusEnum.passed;
|
|
25
|
+
this.start_time = null;
|
|
26
|
+
this.end_time = null;
|
|
27
|
+
this.duration = null;
|
|
28
|
+
this.stacktrace = null;
|
|
29
|
+
this.thread = null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.TestExecution = TestExecution;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { TestStepType } from './test-step';
|
|
2
|
+
import { Attachment } from './attachment';
|
|
3
|
+
import { TestExecution } from './test-execution';
|
|
4
|
+
/**
|
|
5
|
+
* Project code to test case IDs mapping for multi-project support.
|
|
6
|
+
* Key: project code (string), Value: array of test case IDs (numbers).
|
|
7
|
+
*/
|
|
8
|
+
export type ProjectCaseMapping = Record<string, number[]>;
|
|
9
|
+
export declare class TestResultType {
|
|
10
|
+
id: string;
|
|
11
|
+
title: string;
|
|
12
|
+
signature: string;
|
|
13
|
+
run_id: number | null;
|
|
14
|
+
case_id: number | number[] | null;
|
|
15
|
+
/**
|
|
16
|
+
* Multi-project mapping: project code -> array of test case IDs.
|
|
17
|
+
* When set, overrides case_id for multi-project mode.
|
|
18
|
+
* If empty/null, fall back to case_id for single project.
|
|
19
|
+
*/
|
|
20
|
+
project_case_mapping: ProjectCaseMapping | null;
|
|
21
|
+
execution: TestExecution;
|
|
22
|
+
fields: Record<string, string>;
|
|
23
|
+
attachments: Attachment[];
|
|
24
|
+
steps: TestStepType[];
|
|
25
|
+
params: Record<string, string>;
|
|
26
|
+
group_params: Record<string, string>;
|
|
27
|
+
author: string | null;
|
|
28
|
+
relations: Relation | null;
|
|
29
|
+
muted: boolean;
|
|
30
|
+
message: string | null;
|
|
31
|
+
tags: string[];
|
|
32
|
+
preparedAttachments?: string[];
|
|
33
|
+
constructor(title: string);
|
|
34
|
+
}
|
|
35
|
+
export interface Relation {
|
|
36
|
+
suite?: Suite;
|
|
37
|
+
}
|
|
38
|
+
export interface Suite {
|
|
39
|
+
data: SuiteData[];
|
|
40
|
+
}
|
|
41
|
+
export interface SuiteData {
|
|
42
|
+
title: string;
|
|
43
|
+
public_id: number | null;
|
|
44
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TestResultType = void 0;
|
|
4
|
+
const test_execution_1 = require("./test-execution");
|
|
5
|
+
class TestResultType {
|
|
6
|
+
id;
|
|
7
|
+
title;
|
|
8
|
+
signature;
|
|
9
|
+
run_id;
|
|
10
|
+
case_id;
|
|
11
|
+
/**
|
|
12
|
+
* Multi-project mapping: project code -> array of test case IDs.
|
|
13
|
+
* When set, overrides case_id for multi-project mode.
|
|
14
|
+
* If empty/null, fall back to case_id for single project.
|
|
15
|
+
*/
|
|
16
|
+
project_case_mapping;
|
|
17
|
+
execution;
|
|
18
|
+
fields;
|
|
19
|
+
attachments;
|
|
20
|
+
steps;
|
|
21
|
+
params;
|
|
22
|
+
group_params;
|
|
23
|
+
author;
|
|
24
|
+
relations;
|
|
25
|
+
muted;
|
|
26
|
+
message;
|
|
27
|
+
tags;
|
|
28
|
+
preparedAttachments;
|
|
29
|
+
constructor(title) {
|
|
30
|
+
this.id = '';
|
|
31
|
+
this.title = title;
|
|
32
|
+
this.signature = '';
|
|
33
|
+
this.run_id = null;
|
|
34
|
+
this.case_id = null;
|
|
35
|
+
this.project_case_mapping = null;
|
|
36
|
+
this.execution = new test_execution_1.TestExecution();
|
|
37
|
+
this.fields = {};
|
|
38
|
+
this.attachments = [];
|
|
39
|
+
this.steps = [];
|
|
40
|
+
this.params = {};
|
|
41
|
+
this.group_params = {};
|
|
42
|
+
this.author = null;
|
|
43
|
+
this.relations = null;
|
|
44
|
+
this.muted = false;
|
|
45
|
+
this.message = null;
|
|
46
|
+
this.tags = [];
|
|
47
|
+
this.preparedAttachments = [];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.TestResultType = TestResultType;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { StepGherkinData, StepRequestData, StepTextData } from './step-data';
|
|
2
|
+
import { StepExecution } from './step-execution';
|
|
3
|
+
import { Attachment } from './attachment';
|
|
4
|
+
export declare enum StepType {
|
|
5
|
+
TEXT = "text",
|
|
6
|
+
GHERKIN = "gherkin",
|
|
7
|
+
REQUEST = "request"
|
|
8
|
+
}
|
|
9
|
+
export declare class TestStepType {
|
|
10
|
+
id: string;
|
|
11
|
+
step_type: StepType;
|
|
12
|
+
data: StepTextData | StepGherkinData | StepRequestData;
|
|
13
|
+
parent_id: string | null;
|
|
14
|
+
execution: StepExecution;
|
|
15
|
+
attachments: Attachment[];
|
|
16
|
+
steps: TestStepType[];
|
|
17
|
+
constructor(type?: StepType);
|
|
18
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TestStepType = exports.StepType = void 0;
|
|
4
|
+
const step_execution_1 = require("./step-execution");
|
|
5
|
+
var StepType;
|
|
6
|
+
(function (StepType) {
|
|
7
|
+
StepType["TEXT"] = "text";
|
|
8
|
+
StepType["GHERKIN"] = "gherkin";
|
|
9
|
+
StepType["REQUEST"] = "request";
|
|
10
|
+
})(StepType || (exports.StepType = StepType = {}));
|
|
11
|
+
class TestStepType {
|
|
12
|
+
id;
|
|
13
|
+
step_type;
|
|
14
|
+
data;
|
|
15
|
+
parent_id;
|
|
16
|
+
execution;
|
|
17
|
+
attachments;
|
|
18
|
+
steps;
|
|
19
|
+
constructor(type = StepType.TEXT) {
|
|
20
|
+
this.id = '';
|
|
21
|
+
this.step_type = type;
|
|
22
|
+
this.parent_id = null;
|
|
23
|
+
this.execution = new step_execution_1.StepExecution();
|
|
24
|
+
this.attachments = [];
|
|
25
|
+
this.steps = [];
|
|
26
|
+
if (type === StepType.TEXT) {
|
|
27
|
+
this.data = {
|
|
28
|
+
action: '',
|
|
29
|
+
expected_result: null,
|
|
30
|
+
data: null,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
else if (type === StepType.GHERKIN) {
|
|
34
|
+
this.data = {
|
|
35
|
+
keyword: '',
|
|
36
|
+
name: '',
|
|
37
|
+
line: 0,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
this.data = {
|
|
42
|
+
request_method: '',
|
|
43
|
+
request_url: '',
|
|
44
|
+
request_headers: null,
|
|
45
|
+
request_body: null,
|
|
46
|
+
status_code: null,
|
|
47
|
+
response_body: null,
|
|
48
|
+
response_headers: null,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.TestStepType = TestStepType;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type MergedType<T extends unknown[], A = NonNullable<unknown>> = T extends [infer F, ...(infer R)] ? MergedType<R, F & A> : A;
|
|
2
|
+
declare module 'lodash' {
|
|
3
|
+
interface LoDashStatic {
|
|
4
|
+
mergeWith<T extends unknown[]>(...args: [...T, MergeWithCustomizer]): MergedType<T>;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export declare const composeOptions: <T extends unknown[]>(...args: T) => MergedType<[NonNullable<unknown>, ...T]>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.composeOptions = void 0;
|
|
7
|
+
const lodash_mergewith_1 = __importDefault(require("lodash.mergewith"));
|
|
8
|
+
const skipUndef = (value, src) => (src === undefined ? value : undefined);
|
|
9
|
+
const composeOptions = (...args) => {
|
|
10
|
+
return (0, lodash_mergewith_1.default)({}, ...args, skipUndef);
|
|
11
|
+
};
|
|
12
|
+
exports.composeOptions = composeOptions;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.composeOptions = exports.ModeEnum = void 0;
|
|
4
|
+
var mode_enum_1 = require("./mode-enum");
|
|
5
|
+
Object.defineProperty(exports, "ModeEnum", { enumerable: true, get: function () { return mode_enum_1.ModeEnum; } });
|
|
6
|
+
var composeOptions_1 = require("./composeOptions");
|
|
7
|
+
Object.defineProperty(exports, "composeOptions", { enumerable: true, get: function () { return composeOptions_1.composeOptions; } });
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ModeEnum = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @enum {string}
|
|
6
|
+
*/
|
|
7
|
+
var ModeEnum;
|
|
8
|
+
(function (ModeEnum) {
|
|
9
|
+
ModeEnum["report"] = "report";
|
|
10
|
+
ModeEnum["tiden"] = "tiden";
|
|
11
|
+
ModeEnum["off"] = "off";
|
|
12
|
+
})(ModeEnum || (exports.ModeEnum = ModeEnum = {}));
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ModeEnum } from './mode-enum';
|
|
2
|
+
import { DriverEnum, FsWriterOptionsType } from '../writer';
|
|
3
|
+
import { TidenOptionsType } from '../models/config/TidenOptionsType';
|
|
4
|
+
type RecursivePartial<T> = {
|
|
5
|
+
[K in keyof T]?: RecursivePartial<T[K]> | undefined;
|
|
6
|
+
};
|
|
7
|
+
export type ConnectionsType = {
|
|
8
|
+
[DriverEnum.local]?: FsWriterOptionsType;
|
|
9
|
+
};
|
|
10
|
+
export type AdditionalReportOptionsType = {
|
|
11
|
+
driver?: `${DriverEnum}`;
|
|
12
|
+
connections?: ConnectionsType;
|
|
13
|
+
};
|
|
14
|
+
export type LoggingOptionsType = {
|
|
15
|
+
console?: boolean | undefined;
|
|
16
|
+
file?: boolean | undefined;
|
|
17
|
+
};
|
|
18
|
+
export type OptionsType = {
|
|
19
|
+
frameworkPackage: string;
|
|
20
|
+
frameworkName: string;
|
|
21
|
+
reporterName: string;
|
|
22
|
+
mode?: `${ModeEnum}` | undefined;
|
|
23
|
+
fallback?: `${ModeEnum}` | undefined;
|
|
24
|
+
captureLogs?: boolean | undefined;
|
|
25
|
+
debug?: boolean | undefined;
|
|
26
|
+
environment?: string | undefined;
|
|
27
|
+
rootSuite?: string | undefined;
|
|
28
|
+
statusMapping?: Record<string, string> | undefined;
|
|
29
|
+
logging?: RecursivePartial<LoggingOptionsType> | undefined;
|
|
30
|
+
tiden?: RecursivePartial<TidenOptionsType> | undefined;
|
|
31
|
+
report?: RecursivePartial<AdditionalReportOptionsType> | undefined;
|
|
32
|
+
profilers?: string[] | undefined;
|
|
33
|
+
networkProfiler?: {
|
|
34
|
+
skip_domains?: string[] | undefined;
|
|
35
|
+
track_on_fail?: boolean | undefined;
|
|
36
|
+
} | undefined;
|
|
37
|
+
};
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
import { TestStepType } from '../models/test-step';
|
|
3
|
+
interface ProfilerRef {
|
|
4
|
+
shouldSkip(url: string): boolean;
|
|
5
|
+
trackOnFail: boolean;
|
|
6
|
+
fallbackSteps: TestStepType[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* FetchInterceptor subscribes to undici diagnostics_channel events to capture
|
|
10
|
+
* outgoing fetch() calls as REQUEST-type steps in the AsyncLocalStorage store.
|
|
11
|
+
*
|
|
12
|
+
* Works with Node.js 18+ global fetch (which uses undici internally).
|
|
13
|
+
* Gracefully skips subscription on Node < 18 (no global fetch).
|
|
14
|
+
*
|
|
15
|
+
* Key design decisions:
|
|
16
|
+
* - WeakMap keyed on undici request objects (same reference across all events)
|
|
17
|
+
* - ALS context captured at undici:request:create time, NOT at headers time.
|
|
18
|
+
* This is critical because undici connection pooling can break AsyncLocalStorage
|
|
19
|
+
* propagation between the create and headers events when connections are reused.
|
|
20
|
+
* - globalThis.fetch wrapping intercepts error response bodies (undici:request:bodyChunkReceived
|
|
21
|
+
* is not available in Node 22's built-in undici)
|
|
22
|
+
* - All handlers wrapped in try/catch (INTC-06: silent failure)
|
|
23
|
+
*
|
|
24
|
+
* Event flow:
|
|
25
|
+
* undici:request:create → capture method, URL, start time, ALS context → WeakMap
|
|
26
|
+
* undici:request:headers → build step using WeakMap data, push to ALS accumulator
|
|
27
|
+
* undici:request:trailers → cleanup WeakMap entry
|
|
28
|
+
* fetch wrapper → update response_body for error responses (>= 400)
|
|
29
|
+
*/
|
|
30
|
+
export declare class FetchInterceptor {
|
|
31
|
+
private readonly store;
|
|
32
|
+
private readonly profiler;
|
|
33
|
+
private readonly pendingRequests;
|
|
34
|
+
private readonly bodyHandlers;
|
|
35
|
+
private readonly createHandler;
|
|
36
|
+
private readonly headersHandler;
|
|
37
|
+
private readonly trailersHandler;
|
|
38
|
+
private origFetch;
|
|
39
|
+
constructor(store: AsyncLocalStorage<TestStepType[]>, profiler: ProfilerRef);
|
|
40
|
+
/**
|
|
41
|
+
* Subscribe to undici diagnostics_channel events and wrap global fetch for
|
|
42
|
+
* error response body capture.
|
|
43
|
+
*
|
|
44
|
+
* No-op on Node < 18 (no global fetch) or if diagnostics_channel unavailable.
|
|
45
|
+
*/
|
|
46
|
+
subscribe(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Unsubscribe from diagnostics_channel events and restore original global fetch.
|
|
49
|
+
*/
|
|
50
|
+
unsubscribe(): void;
|
|
51
|
+
private handleCreate;
|
|
52
|
+
private handleHeaders;
|
|
53
|
+
private handleTrailers;
|
|
54
|
+
/**
|
|
55
|
+
* Called by the fetch wrapper when an error response body is available.
|
|
56
|
+
* Finds the most recently added step for this URL/status and updates its response_body.
|
|
57
|
+
*/
|
|
58
|
+
private applyResponseBody;
|
|
59
|
+
}
|
|
60
|
+
export {};
|