qase-javascript-commons 2.7.0 → 2.7.1
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
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## 2.7.1
|
|
2
|
+
|
|
3
|
+
### Fixed
|
|
4
|
+
- HTTP/fetch profiler steps now emit `execution.start_time` and `execution.end_time` as Unix epoch seconds (with fractional ms), matching the Qase API contract. Previously the interceptor wrote `Date.now()` milliseconds directly into both fields, placing every captured request step ~55 years in the future on the timeline. `execution.duration` remains in milliseconds.
|
|
5
|
+
- `ReportReporter` test-run summary (`report.execution.start_time` / `end_time` in the generated JSON report) is now emitted in Unix seconds instead of milliseconds; this aligns the report-mode file with the v2 API spec consumed by `reporters-validator`.
|
|
6
|
+
- `QaseStep.run` (the shared user-facing `qase.step()` API used by Jest, Vitest, WebdriverIO and TestCafe) now emits `execution.start_time` / `end_time` in Unix seconds instead of raw `Date.now()` milliseconds, and populates `execution.duration` (ms). Previously every `qase.step()` call landed ~55 years in the future on the timeline and reported `null` duration.
|
|
7
|
+
|
|
1
8
|
## 2.7.0
|
|
2
9
|
|
|
3
10
|
### Added
|
|
@@ -28,6 +28,13 @@ export declare function extractRequestInfo(args: [
|
|
|
28
28
|
* to `Record<string, string>`. Multi-value headers joined with `', '`. Undefined values skipped.
|
|
29
29
|
*/
|
|
30
30
|
export declare function headersToRecord(headers: http.IncomingHttpHeaders): Record<string, string>;
|
|
31
|
+
/**
|
|
32
|
+
* Builds a REQUEST-type step from raw timing data.
|
|
33
|
+
*
|
|
34
|
+
* `startTime` / `endTime` are expected as `Date.now()` values (ms since epoch).
|
|
35
|
+
* They are normalized to Unix seconds (with fractional ms) for `step.execution.start_time` /
|
|
36
|
+
* `end_time` per Qase API spec; `duration` stays in ms.
|
|
37
|
+
*/
|
|
31
38
|
export declare function buildRequestStep(params: {
|
|
32
39
|
method: string;
|
|
33
40
|
url: string;
|
|
@@ -68,6 +68,13 @@ function headersToRecord(headers) {
|
|
|
68
68
|
return result;
|
|
69
69
|
}
|
|
70
70
|
// ─── Utility: buildRequestStep ───────────────────────────────────────────────
|
|
71
|
+
/**
|
|
72
|
+
* Builds a REQUEST-type step from raw timing data.
|
|
73
|
+
*
|
|
74
|
+
* `startTime` / `endTime` are expected as `Date.now()` values (ms since epoch).
|
|
75
|
+
* They are normalized to Unix seconds (with fractional ms) for `step.execution.start_time` /
|
|
76
|
+
* `end_time` per Qase API spec; `duration` stays in ms.
|
|
77
|
+
*/
|
|
71
78
|
function buildRequestStep(params) {
|
|
72
79
|
const step = new test_step_1.TestStepType(test_step_1.StepType.REQUEST);
|
|
73
80
|
step.id = (0, uuid_1.v4)();
|
|
@@ -79,8 +86,8 @@ function buildRequestStep(params) {
|
|
|
79
86
|
data.status_code = params.statusCode;
|
|
80
87
|
data.response_body = params.responseBody;
|
|
81
88
|
data.response_headers = params.responseHeaders;
|
|
82
|
-
step.execution.start_time = params.startTime;
|
|
83
|
-
step.execution.end_time = params.endTime;
|
|
89
|
+
step.execution.start_time = params.startTime / 1000;
|
|
90
|
+
step.execution.end_time = params.endTime / 1000;
|
|
84
91
|
step.execution.duration = params.endTime - params.startTime;
|
|
85
92
|
step.execution.status = params.statusCode >= 400 ? step_execution_1.StepStatusEnum.failed : step_execution_1.StepStatusEnum.passed;
|
|
86
93
|
return step;
|
|
@@ -89,12 +89,13 @@ class ReportReporter extends abstract_reporter_1.AbstractReporter {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
async complete() {
|
|
92
|
+
const endTime = Date.now();
|
|
92
93
|
const report = {
|
|
93
94
|
title: 'Test run',
|
|
94
95
|
execution: {
|
|
95
|
-
start_time: this.startTime,
|
|
96
|
-
end_time:
|
|
97
|
-
duration:
|
|
96
|
+
start_time: this.startTime / 1000,
|
|
97
|
+
end_time: endTime / 1000,
|
|
98
|
+
duration: endTime - this.startTime,
|
|
98
99
|
cumulative_duration: 0,
|
|
99
100
|
},
|
|
100
101
|
stats: {
|
package/dist/steps/step.js
CHANGED
|
@@ -52,32 +52,30 @@ class QaseStep {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
async run(body, messageEmitter) {
|
|
55
|
-
const
|
|
55
|
+
const startMs = Date.now();
|
|
56
56
|
const step = new models_1.TestStepType();
|
|
57
57
|
step.data = {
|
|
58
58
|
action: this.name,
|
|
59
59
|
expected_result: null,
|
|
60
60
|
data: null,
|
|
61
61
|
};
|
|
62
|
+
// Per Qase API spec: start_time / end_time are Unix epoch seconds (with
|
|
63
|
+
// fractional ms); duration is milliseconds.
|
|
64
|
+
const buildExecution = (status, endMs) => ({
|
|
65
|
+
start_time: startMs / 1000,
|
|
66
|
+
end_time: endMs / 1000,
|
|
67
|
+
status,
|
|
68
|
+
duration: endMs - startMs,
|
|
69
|
+
});
|
|
62
70
|
try {
|
|
63
71
|
await body.call(this, this);
|
|
64
|
-
step.execution =
|
|
65
|
-
start_time: startDate,
|
|
66
|
-
end_time: new Date().getTime(),
|
|
67
|
-
status: models_1.StepStatusEnum.passed,
|
|
68
|
-
duration: null,
|
|
69
|
-
};
|
|
72
|
+
step.execution = buildExecution(models_1.StepStatusEnum.passed, Date.now());
|
|
70
73
|
step.attachments = this.attachments;
|
|
71
74
|
step.steps = this.steps;
|
|
72
75
|
await messageEmitter(step);
|
|
73
76
|
}
|
|
74
77
|
catch (error) {
|
|
75
|
-
step.execution =
|
|
76
|
-
start_time: startDate,
|
|
77
|
-
end_time: new Date().getTime(),
|
|
78
|
-
status: models_1.StepStatusEnum.failed,
|
|
79
|
-
duration: null,
|
|
80
|
-
};
|
|
78
|
+
step.execution = buildExecution(models_1.StepStatusEnum.failed, Date.now());
|
|
81
79
|
step.attachments = this.attachments;
|
|
82
80
|
step.steps = this.steps;
|
|
83
81
|
await messageEmitter(step);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qase-javascript-commons",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"description": "Qase JS Reporters",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@types/mime-types": "^2.1.4",
|
|
69
69
|
"@types/minimatch": "^6.0.0",
|
|
70
70
|
"@types/uuid": "^9.0.8",
|
|
71
|
-
"axios": "^1.15.
|
|
71
|
+
"axios": "^1.15.2",
|
|
72
72
|
"jest": "^29.7.0",
|
|
73
73
|
"ts-jest": "^29.4.5"
|
|
74
74
|
}
|