qase-javascript-commons 2.0.0-beta.2 → 2.0.0-beta.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 CHANGED
@@ -1,3 +1,17 @@
1
+ # qase-javascript-commons@2.0.0-beta.4
2
+
3
+ ## What's new
4
+
5
+ * Added support for uploading attachments from strings and buffers in the testops reporter.
6
+ * Changed data type of `content` in the attachment data from `any` to `string | Buffer`.
7
+
8
+ # qase-javascript-commons@2.0.0-beta.3
9
+
10
+ ## What's new
11
+
12
+ * Changed data type of `fields` and `parameters` in the test result data
13
+ from `Map<string, string>` to `Record<string, string>`.
14
+
1
15
  # qase-javascript-commons@2.0.0-beta.2
2
16
 
3
17
  ## Overview
@@ -1,8 +1,9 @@
1
+ /// <reference types="node" />
1
2
  export type Attachment = {
2
3
  file_name: string;
3
4
  mime_type: string;
4
5
  file_path: string | null;
5
- content: any;
6
+ content: string | Buffer;
6
7
  size: number;
7
8
  id: string;
8
9
  };
@@ -8,10 +8,10 @@ export type TestResultType = {
8
8
  run_id: number | null;
9
9
  testops_id: number | number[] | null;
10
10
  execution: TestExecution;
11
- fields: Map<string, string>;
11
+ fields: Record<string, string>;
12
12
  attachments: Attachment[];
13
13
  steps: TestStepType[];
14
- params: Map<string, string>;
14
+ params: Record<string, string>;
15
15
  author: string | null;
16
16
  relations: any[];
17
17
  muted: boolean;
@@ -92,7 +92,7 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
92
92
  testops_id: Array.isArray(result.testops_id) ? null : result.testops_id,
93
93
  attachments: attachments,
94
94
  steps: steps,
95
- params: {},
95
+ params: result.params,
96
96
  relations: {
97
97
  // suite: {
98
98
  // data: result.suiteTitle ? this.getSuites(result.suiteTitle) : [],
@@ -193,10 +193,15 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
193
193
  try {
194
194
  let data;
195
195
  if (attachment.file_path) {
196
- data = (0, fs_1.createReadStream)(attachment.file_path);
196
+ data = { name: attachment.file_name, value: (0, fs_1.createReadStream)(attachment.file_path) };
197
197
  }
198
198
  else {
199
- data = attachment.content;
199
+ if (typeof attachment.content === 'string') {
200
+ data = { name: attachment.file_name, value: Buffer.from(attachment.content) };
201
+ }
202
+ else {
203
+ data = { name: attachment.file_name, value: attachment.content };
204
+ }
200
205
  }
201
206
  const response = await this.api.attachments.uploadAttachment(this.projectCode, [data]);
202
207
  if (response.data.result?.[0]?.hash != undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qase-javascript-commons",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.4",
4
4
  "description": "Qase JS Reporters",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "lodash.get": "^4.4.2",
32
32
  "lodash.merge": "^4.6.2",
33
33
  "lodash.mergewith": "^4.6.2",
34
- "qaseio": "^2.1.0-beta.0",
34
+ "qaseio": "^2.1.0-beta.1",
35
35
  "strip-ansi": "^6.0.1",
36
36
  "uuid": "^9.0.0",
37
37
  "child-process-ext": "^3.0.2"