qase-javascript-commons 2.5.8 → 2.5.10

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,19 @@
1
+ # qase-javascript-commons@2.5.10
2
+
3
+ ## What's new
4
+
5
+ Unified HostData model to align field names across all Qase reporter languages:
6
+
7
+ - Renamed `node` → `language` and `npm` → `packageManager` in the `HostData` interface.
8
+ - Normalized `system` field: `win32` is now reported as `windows`.
9
+ - X-Platform and X-Client headers continue to use language-specific keys (`node=`, `npm=`).
10
+
11
+ # qase-javascript-commons@2.5.9
12
+
13
+ ## Bug fixes
14
+
15
+ - Fixed shallow copy bug in `addTestResult` when splitting multi-ID test results. The `execution` object is now deep-copied, preventing shared reference mutation that zeroed out `duration` for all copies.
16
+
1
17
  # qase-javascript-commons@2.5.8
2
18
 
3
19
  ## Bug fixes
@@ -93,11 +93,11 @@ class ClientV2 extends clientV1_1.ClientV1 {
93
93
  if (hostData.arch && hostData.arch.trim()) {
94
94
  platformParts.push(`arch=${hostData.arch}`);
95
95
  }
96
- if (hostData.node && hostData.node.trim()) {
97
- platformParts.push(`node=${hostData.node}`);
96
+ if (hostData.language && hostData.language.trim()) {
97
+ platformParts.push(`node=${hostData.language}`);
98
98
  }
99
- if (hostData.npm && hostData.npm.trim()) {
100
- platformParts.push(`npm=${hostData.npm}`);
99
+ if (hostData.packageManager && hostData.packageManager.trim()) {
100
+ platformParts.push(`npm=${hostData.packageManager}`);
101
101
  }
102
102
  if (platformParts.length > 0) {
103
103
  headers['X-Platform'] = platformParts.join(';');
@@ -4,8 +4,8 @@ export interface HostData {
4
4
  release: string;
5
5
  version: string;
6
6
  arch: string;
7
- node: string;
8
- npm: string;
7
+ language: string;
8
+ packageManager: string;
9
9
  framework: string;
10
10
  reporter: string;
11
11
  commons: string;
@@ -52,7 +52,7 @@ class AbstractReporter {
52
52
  // if we have multiple ids, we need to create multiple test results and set duration to 0 for all but the first one
53
53
  let firstCase = true;
54
54
  for (const id of result.testops_id) {
55
- const testResultCopy = { ...result };
55
+ const testResultCopy = { ...result, execution: { ...result.execution } };
56
56
  testResultCopy.testops_id = id;
57
57
  testResultCopy.id = (0, uuid_1.v4)();
58
58
  if (!firstCase) {
@@ -38,6 +38,16 @@ const os = __importStar(require("os"));
38
38
  const cp = __importStar(require("child_process"));
39
39
  const fs = __importStar(require("fs"));
40
40
  const get_package_version_1 = require("./get-package-version");
41
+ /**
42
+ * Normalizes platform name to unified format
43
+ * @param {string} platform - process.platform value
44
+ * @returns {string} Normalized platform name
45
+ */
46
+ function normalizePlatform(platform) {
47
+ if (platform === 'win32')
48
+ return 'windows';
49
+ return platform;
50
+ }
41
51
  /**
42
52
  * Gets detailed OS information based on the platform
43
53
  * @returns {string} Detailed OS information
@@ -101,13 +111,13 @@ function getNpmVersion() {
101
111
  function getHostInfo(framework, reporterName) {
102
112
  try {
103
113
  return {
104
- system: process.platform,
114
+ system: normalizePlatform(process.platform),
105
115
  machineName: os.hostname(),
106
116
  release: os.release(),
107
117
  version: getDetailedOSInfo(),
108
118
  arch: os.arch(),
109
- node: process.version,
110
- npm: getNpmVersion(),
119
+ language: process.version,
120
+ packageManager: getNpmVersion(),
111
121
  framework: (0, get_package_version_1.getPackageVersion)(framework) ?? '',
112
122
  reporter: (0, get_package_version_1.getPackageVersion)(reporterName) ?? '',
113
123
  commons: (0, get_package_version_1.getPackageVersion)('qase-javascript-commons') ?? '',
@@ -117,13 +127,13 @@ function getHostInfo(framework, reporterName) {
117
127
  }
118
128
  catch (error) {
119
129
  return {
120
- system: process.platform,
130
+ system: normalizePlatform(process.platform),
121
131
  machineName: os.hostname() || '',
122
132
  release: os.release(),
123
133
  version: '',
124
134
  arch: os.arch(),
125
- node: '',
126
- npm: '',
135
+ language: '',
136
+ packageManager: '',
127
137
  framework: '',
128
138
  reporter: '',
129
139
  commons: '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qase-javascript-commons",
3
- "version": "2.5.8",
3
+ "version": "2.5.10",
4
4
  "description": "Qase JS Reporters",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",