jest-qase-reporter 2.0.5 → 2.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/README.md CHANGED
@@ -116,7 +116,7 @@ describe('My First Test', () => {
116
116
  To run tests and create a test run, execute the command (for example from folder examples):
117
117
 
118
118
  ```bash
119
- QASE_MODE=testops npx jest
119
+ QASE_MODE=testops npx jest --runInBand
120
120
  ```
121
121
 
122
122
  or
package/changelog.md CHANGED
@@ -1,3 +1,10 @@
1
+ # jest-qase-reporter@2.1.0
2
+
3
+ ## What's new
4
+
5
+ - Updated to the latest minor version of the common package for improved compatibility and features.
6
+ - Fixed all ESLint warnings across the project to ensure code quality and maintainability.
7
+
1
8
  # jest-qase-reporter@2.0.4
2
9
 
3
10
  ## What's new
package/dist/jest.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { StepFunction } from './step';
1
+ import { StepFunction } from 'qase-javascript-commons';
2
2
  export declare const qase: {
3
3
  (caseId: number | string | number[] | string[], name: string): string;
4
4
  /**
package/dist/jest.js CHANGED
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.qase = void 0;
7
- const step_1 = require("./step");
8
7
  const path_1 = __importDefault(require("path"));
9
8
  const qase_javascript_commons_1 = require("qase-javascript-commons");
10
9
  const uuid_1 = require("uuid");
@@ -109,7 +108,7 @@ exports.qase.groupParameters = (values) => {
109
108
  * });
110
109
  */
111
110
  exports.qase.step = async (name, body) => {
112
- const runningStep = new step_1.QaseStep(name);
111
+ const runningStep = new qase_javascript_commons_1.QaseStep(name);
113
112
  // eslint-disable-next-line @typescript-eslint/require-await
114
113
  await runningStep.run(body, async (step) => global.Qase.step(step));
115
114
  };
@@ -102,4 +102,5 @@ export declare class JestQaseReporter implements Reporter {
102
102
  * @private
103
103
  */
104
104
  private removeQaseIdsFromTitle;
105
+ onRunnerEnd(): Promise<void>;
105
106
  }
package/dist/reporter.js CHANGED
@@ -70,7 +70,7 @@ class JestQaseReporter {
70
70
  * @see {Reporter.onRunStart}
71
71
  */
72
72
  onRunStart() {
73
- void this.reporter.startTestRun();
73
+ this.reporter.startTestRun();
74
74
  }
75
75
  onTestCaseResult(test, testCaseResult) {
76
76
  if (this.metadata.ignore) {
@@ -288,5 +288,8 @@ class JestQaseReporter {
288
288
  }
289
289
  return title;
290
290
  }
291
+ async onRunnerEnd() {
292
+ await this.reporter.publish();
293
+ }
291
294
  }
292
295
  exports.JestQaseReporter = JestQaseReporter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jest-qase-reporter",
3
- "version": "2.0.5",
3
+ "version": "2.1.0",
4
4
  "description": "Qase TMS Jest Reporter",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -45,7 +45,7 @@
45
45
  "dependencies": {
46
46
  "lodash.get": "^4.4.2",
47
47
  "lodash.has": "^4.5.2",
48
- "qase-javascript-commons": "~2.2.14",
48
+ "qase-javascript-commons": "~2.3.0",
49
49
  "uuid": "^9.0.0"
50
50
  },
51
51
  "devDependencies": {
package/dist/step.d.ts DELETED
@@ -1,16 +0,0 @@
1
- import { Attachment, TestStepType } from 'qase-javascript-commons';
2
- export type StepFunction<T = any> = (this: QaseStep, step: QaseStep) => T | Promise<T>;
3
- export declare class QaseStep {
4
- name: string;
5
- attachments: Attachment[];
6
- steps: TestStepType[];
7
- constructor(name: string);
8
- attach(attach: {
9
- name?: string;
10
- type?: string;
11
- content?: string;
12
- paths?: string[] | string;
13
- }): void;
14
- step(name: string, body: StepFunction): Promise<void>;
15
- run(body: StepFunction, messageEmitter: (step: TestStepType) => Promise<void>): Promise<void>;
16
- }
package/dist/step.js DELETED
@@ -1,89 +0,0 @@
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.QaseStep = void 0;
7
- const qase_javascript_commons_1 = require("qase-javascript-commons");
8
- const uuid_1 = require("uuid");
9
- const path_1 = __importDefault(require("path"));
10
- // TODO: Move to common, because it's duplicated in qase-wdio/src/step.ts
11
- class QaseStep {
12
- name = '';
13
- attachments = [];
14
- steps = [];
15
- constructor(name) {
16
- this.name = name;
17
- }
18
- attach(attach) {
19
- if (attach.paths) {
20
- const files = Array.isArray(attach.paths) ? attach.paths : [attach.paths];
21
- for (const file of files) {
22
- const attachmentName = path_1.default.basename(file);
23
- const contentType = 'application/octet-stream';
24
- this.attachments.push({
25
- id: (0, uuid_1.v4)(),
26
- file_name: attachmentName,
27
- mime_type: contentType,
28
- content: '',
29
- file_path: file,
30
- size: 0,
31
- });
32
- }
33
- return;
34
- }
35
- if (attach.content) {
36
- const attachmentName = attach.name ?? 'attachment';
37
- const contentType = attach.type ?? 'application/octet-stream';
38
- this.attachments.push({
39
- id: (0, uuid_1.v4)(),
40
- file_name: attachmentName,
41
- mime_type: contentType,
42
- content: attach.content,
43
- file_path: null,
44
- size: attach.content.length,
45
- });
46
- }
47
- }
48
- async step(name, body) {
49
- const childStep = new QaseStep(name);
50
- // eslint-disable-next-line @typescript-eslint/require-await
51
- await childStep.run(body, async (step) => {
52
- this.steps.push(step);
53
- });
54
- }
55
- async run(body, messageEmitter) {
56
- const startDate = new Date().getTime();
57
- const step = new qase_javascript_commons_1.TestStepType();
58
- step.data = {
59
- action: this.name,
60
- expected_result: null,
61
- data: null,
62
- };
63
- try {
64
- await body.call(this, this);
65
- step.execution = {
66
- start_time: startDate,
67
- end_time: new Date().getTime(),
68
- status: qase_javascript_commons_1.StepStatusEnum.passed,
69
- duration: null,
70
- };
71
- step.attachments = this.attachments;
72
- step.steps = this.steps;
73
- await messageEmitter(step);
74
- }
75
- catch (e) {
76
- step.execution = {
77
- start_time: startDate,
78
- end_time: new Date().getTime(),
79
- status: qase_javascript_commons_1.StepStatusEnum.failed,
80
- duration: null,
81
- };
82
- step.attachments = this.attachments;
83
- step.steps = this.steps;
84
- await messageEmitter(step);
85
- throw e;
86
- }
87
- }
88
- }
89
- exports.QaseStep = QaseStep;