qase-javascript-commons 2.1.0 → 2.1.2

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,9 @@
1
+ # qase-javascript-commons@2.1.1
2
+
3
+ ## What's new
4
+
5
+ Fixed an issue where the state file was not deleted. This resulted in results being uploaded into the same test run.
6
+
1
7
  # qase-javascript-commons@2.1.0
2
8
 
3
9
  ## What's new
@@ -0,0 +1,7 @@
1
+ export declare class CompoundError {
2
+ message: string | undefined;
3
+ stacktrace: string | undefined;
4
+ constructor();
5
+ addMessage(message: string): void;
6
+ addStacktrace(stacktrace: string): void;
7
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CompoundError = void 0;
4
+ class CompoundError {
5
+ constructor() {
6
+ this.message = 'CompoundError: One or more errors occurred. ---\n';
7
+ }
8
+ addMessage(message) {
9
+ this.message += `${message}\n--- End of error message ---\n`;
10
+ }
11
+ addStacktrace(stacktrace) {
12
+ if (!this.stacktrace) {
13
+ this.stacktrace = `${indentAll(stacktrace)}\n--- End of stack trace ---\n`;
14
+ return;
15
+ }
16
+ this.stacktrace += `${indentAll(stacktrace)}\n--- End of stack trace ---\n`;
17
+ }
18
+ }
19
+ exports.CompoundError = CompoundError;
20
+ function indentAll(lines) {
21
+ return lines.split('\n').map(x => ' ' + x).join('\n');
22
+ }
@@ -1,6 +1,7 @@
1
- export { type TestResultType, Relation, Suite, SuiteData } from './test-result';
1
+ export { TestResultType, Relation, Suite, SuiteData } from './test-result';
2
2
  export { TestExecution, TestStatusEnum } from './test-execution';
3
- export { type TestStepType, StepType } from './test-step';
3
+ export { TestStepType, StepType } from './test-step';
4
4
  export { StepStatusEnum } from './step-execution';
5
5
  export { Attachment } from './attachment';
6
6
  export { Report } from './report';
7
+ export { CompoundError } from './error';
@@ -1,9 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StepStatusEnum = exports.StepType = exports.TestStatusEnum = void 0;
3
+ exports.CompoundError = exports.StepStatusEnum = exports.StepType = exports.TestStepType = exports.TestStatusEnum = exports.TestExecution = exports.TestResultType = void 0;
4
+ var test_result_1 = require("./test-result");
5
+ Object.defineProperty(exports, "TestResultType", { enumerable: true, get: function () { return test_result_1.TestResultType; } });
4
6
  var test_execution_1 = require("./test-execution");
7
+ Object.defineProperty(exports, "TestExecution", { enumerable: true, get: function () { return test_execution_1.TestExecution; } });
5
8
  Object.defineProperty(exports, "TestStatusEnum", { enumerable: true, get: function () { return test_execution_1.TestStatusEnum; } });
6
9
  var test_step_1 = require("./test-step");
10
+ Object.defineProperty(exports, "TestStepType", { enumerable: true, get: function () { return test_step_1.TestStepType; } });
7
11
  Object.defineProperty(exports, "StepType", { enumerable: true, get: function () { return test_step_1.StepType; } });
8
12
  var step_execution_1 = require("./step-execution");
9
13
  Object.defineProperty(exports, "StepStatusEnum", { enumerable: true, get: function () { return step_execution_1.StepStatusEnum; } });
14
+ var error_1 = require("./error");
15
+ Object.defineProperty(exports, "CompoundError", { enumerable: true, get: function () { return error_1.CompoundError; } });
@@ -4,9 +4,10 @@ export declare enum StepStatusEnum {
4
4
  blocked = "blocked",
5
5
  skipped = "skipped"
6
6
  }
7
- export interface StepExecution {
7
+ export declare class StepExecution {
8
8
  start_time: number | null;
9
9
  status: StepStatusEnum;
10
10
  end_time: number | null;
11
11
  duration: number | null;
12
+ constructor();
12
13
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StepStatusEnum = void 0;
3
+ exports.StepExecution = exports.StepStatusEnum = void 0;
4
4
  var StepStatusEnum;
5
5
  (function (StepStatusEnum) {
6
6
  StepStatusEnum["passed"] = "passed";
@@ -8,3 +8,12 @@ var StepStatusEnum;
8
8
  StepStatusEnum["blocked"] = "blocked";
9
9
  StepStatusEnum["skipped"] = "skipped";
10
10
  })(StepStatusEnum || (exports.StepStatusEnum = StepStatusEnum = {}));
11
+ class StepExecution {
12
+ constructor() {
13
+ this.status = StepStatusEnum.passed;
14
+ this.start_time = null;
15
+ this.end_time = null;
16
+ this.duration = null;
17
+ }
18
+ }
19
+ exports.StepExecution = StepExecution;
@@ -9,11 +9,12 @@ export declare enum TestStatusEnum {
9
9
  blocked = "blocked",
10
10
  invalid = "invalid"
11
11
  }
12
- export interface TestExecution {
12
+ export declare class TestExecution {
13
13
  start_time: number | null;
14
14
  status: TestStatusEnum;
15
15
  end_time: number | null;
16
16
  duration: number | null;
17
17
  stacktrace: string | null;
18
18
  thread: string | null;
19
+ constructor();
19
20
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TestStatusEnum = void 0;
3
+ exports.TestExecution = exports.TestStatusEnum = void 0;
4
4
  /**
5
5
  * @enum {string}
6
6
  */
@@ -13,3 +13,14 @@ var TestStatusEnum;
13
13
  TestStatusEnum["blocked"] = "blocked";
14
14
  TestStatusEnum["invalid"] = "invalid";
15
15
  })(TestStatusEnum || (exports.TestStatusEnum = TestStatusEnum = {}));
16
+ class TestExecution {
17
+ constructor() {
18
+ this.status = TestStatusEnum.passed;
19
+ this.start_time = null;
20
+ this.end_time = null;
21
+ this.duration = null;
22
+ this.stacktrace = null;
23
+ this.thread = null;
24
+ }
25
+ }
26
+ exports.TestExecution = TestExecution;
@@ -1,7 +1,7 @@
1
1
  import { TestStepType } from './test-step';
2
2
  import { Attachment } from './attachment';
3
3
  import { TestExecution } from './test-execution';
4
- export type TestResultType = {
4
+ export declare class TestResultType {
5
5
  id: string;
6
6
  title: string;
7
7
  signature: string;
@@ -16,7 +16,8 @@ export type TestResultType = {
16
16
  relations: Relation | null;
17
17
  muted: boolean;
18
18
  message: string | null;
19
- };
19
+ constructor(title: string);
20
+ }
20
21
  export type Relation = {
21
22
  suite?: Suite;
22
23
  };
@@ -1,2 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TestResultType = void 0;
4
+ const test_execution_1 = require("./test-execution");
5
+ class TestResultType {
6
+ constructor(title) {
7
+ this.id = '';
8
+ this.title = title;
9
+ this.signature = '';
10
+ this.run_id = null;
11
+ this.testops_id = null;
12
+ this.execution = new test_execution_1.TestExecution();
13
+ this.fields = {};
14
+ this.attachments = [];
15
+ this.steps = [];
16
+ this.params = {};
17
+ this.author = null;
18
+ this.relations = null;
19
+ this.muted = false;
20
+ this.message = null;
21
+ }
22
+ }
23
+ exports.TestResultType = TestResultType;
@@ -5,7 +5,7 @@ export declare enum StepType {
5
5
  TEXT = "text",
6
6
  GHERKIN = "gherkin"
7
7
  }
8
- export type TestStepType = {
8
+ export declare class TestStepType {
9
9
  id: string;
10
10
  step_type: StepType;
11
11
  data: StepTextData | StepGherkinData;
@@ -13,4 +13,5 @@ export type TestStepType = {
13
13
  execution: StepExecution;
14
14
  attachments: Attachment[];
15
15
  steps: TestStepType[];
16
- };
16
+ constructor(type?: StepType);
17
+ }
@@ -1,8 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StepType = void 0;
3
+ exports.TestStepType = exports.StepType = void 0;
4
+ const step_execution_1 = require("./step-execution");
4
5
  var StepType;
5
6
  (function (StepType) {
6
7
  StepType["TEXT"] = "text";
7
8
  StepType["GHERKIN"] = "gherkin";
8
9
  })(StepType || (exports.StepType = StepType = {}));
10
+ class TestStepType {
11
+ constructor(type = StepType.TEXT) {
12
+ this.id = '';
13
+ this.step_type = type;
14
+ this.parent_id = null;
15
+ this.execution = new step_execution_1.StepExecution();
16
+ this.attachments = [];
17
+ this.steps = [];
18
+ if (type === StepType.TEXT) {
19
+ this.data = {
20
+ action: '',
21
+ expected_result: null,
22
+ };
23
+ }
24
+ else {
25
+ this.data = {
26
+ keyword: '',
27
+ name: '',
28
+ line: 0,
29
+ };
30
+ }
31
+ }
32
+ }
33
+ exports.TestStepType = TestStepType;
package/dist/qase.js CHANGED
@@ -334,6 +334,7 @@ class QaseReporter {
334
334
  await this.publishFallback();
335
335
  }
336
336
  }
337
+ state_1.StateManager.clearState();
337
338
  }
338
339
  /**
339
340
  * @returns {Promise<void>}
@@ -27,6 +27,7 @@ class StateManager {
27
27
  static setMode(mode) {
28
28
  const state = this.getState();
29
29
  state.Mode = mode;
30
+ state.IsModeChanged = true;
30
31
  this.setState(state);
31
32
  }
32
33
  static setIsModeChanged(isModeChanged) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qase-javascript-commons",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Qase JS Reporters",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",