testit-js-commons 2.2.6 → 3.0.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.
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.Utils = void 0;
27
37
  const crypto_1 = require("crypto");
@@ -1,12 +1,11 @@
1
- import type { IClient } from "../../client";
2
- import type { Link, Attachment } from "../../common";
1
+ import type { Link, Attachment, AdapterConfig } from "../../common";
3
2
  import type { IAdditions } from "./additions.type";
4
3
  export declare class Additions implements IAdditions {
5
- private client;
6
4
  links: Link[];
7
5
  attachments: Attachment[];
8
6
  messages: string[];
9
- constructor(client: IClient);
7
+ private client;
8
+ constructor(config: AdapterConfig);
10
9
  addAttachments(paths: string[]): Promise<Attachment[]>;
11
10
  addAttachments(content: string | Buffer, fileName?: string): Promise<Attachment[]>;
12
11
  addLinks(link: Link): void;
@@ -10,12 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Additions = void 0;
13
+ const client_1 = require("../../client");
13
14
  class Additions {
14
- constructor(client) {
15
- this.client = client;
15
+ constructor(config) {
16
16
  this.links = [];
17
17
  this.attachments = [];
18
18
  this.messages = [];
19
+ this.client = new client_1.Client(config);
19
20
  }
20
21
  addAttachments(pathsOrContent, fileName) {
21
22
  return __awaiter(this, void 0, void 0, function* () {
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.ConfigComposer = exports.DEFAULT_CONFIG_FILE = void 0;
27
37
  const dotenv = __importStar(require("dotenv"));
@@ -19,6 +19,7 @@ interface AutotestBase {
19
19
  setup?: Array<ShortStep>;
20
20
  teardown?: Array<ShortStep>;
21
21
  labels?: Array<Label>;
22
+ externalKey?: string;
22
23
  }
23
24
  export interface AutotestPost extends AutotestBase {
24
25
  externalId: string;
@@ -1,12 +1,12 @@
1
1
  import { IClient } from "../client";
2
2
  import { AdapterConfig } from "../common";
3
- import { AutotestPost, AutotestResult } from "../services";
3
+ import { AutotestPost, AutotestResult, TestRunId } from "../services";
4
4
  import { IStrategy } from "./strategy.type";
5
5
  export declare class BaseStrategy implements IStrategy {
6
- protected client: IClient;
7
6
  protected config: AdapterConfig;
8
- testRunId: Promise<string>;
9
- protected constructor(client: IClient, config: AdapterConfig);
7
+ client: IClient;
8
+ testRunId: Promise<TestRunId>;
9
+ protected constructor(config: AdapterConfig);
10
10
  setup(): Promise<void>;
11
11
  teardown(): Promise<void>;
12
12
  loadAutotest(autotest: AutotestPost, isPassed: boolean): Promise<void>;
@@ -10,10 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.BaseStrategy = void 0;
13
+ const client_1 = require("../client");
13
14
  class BaseStrategy {
14
- constructor(client, config) {
15
- this.client = client;
15
+ constructor(config) {
16
16
  this.config = config;
17
+ this.client = new client_1.Client(config);
17
18
  this.testRunId = Promise.resolve(config.testRunId);
18
19
  }
19
20
  setup() {
@@ -1,7 +1,6 @@
1
- import { IClient } from "../client";
2
1
  import { AdapterConfig } from "../common";
3
2
  import { BaseStrategy } from "./base.strategy";
4
3
  import { IStrategy } from "./strategy.type";
5
4
  export declare class FirstStrategy extends BaseStrategy implements IStrategy {
6
- constructor(client: IClient, config: AdapterConfig);
5
+ constructor(config: AdapterConfig);
7
6
  }
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FirstStrategy = void 0;
4
4
  const base_strategy_1 = require("./base.strategy");
5
5
  class FirstStrategy extends base_strategy_1.BaseStrategy {
6
- constructor(client, config) {
7
- super(client, config);
6
+ constructor(config) {
7
+ super(config);
8
8
  if (!config.testRunId)
9
9
  throw new Error("testRunId is required when mode is 1");
10
10
  }
@@ -1,9 +1,8 @@
1
- import { IClient } from "../client";
2
1
  import { AdapterConfig } from "../common";
3
2
  import { IStrategy } from "./strategy.type";
4
3
  import { TestRunId } from "../services";
5
4
  import { BaseStrategy } from "./base.strategy";
6
5
  export declare class SecondStrategy extends BaseStrategy implements IStrategy {
7
6
  testRunId: Promise<TestRunId>;
8
- constructor(client: IClient, config: AdapterConfig);
7
+ constructor(config: AdapterConfig);
9
8
  }
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SecondStrategy = void 0;
4
4
  const base_strategy_1 = require("./base.strategy");
5
5
  class SecondStrategy extends base_strategy_1.BaseStrategy {
6
- constructor(client, config) {
7
- super(client, config);
8
- this.testRunId = client.testRuns.createTestRun();
6
+ constructor(config) {
7
+ super(config);
8
+ this.testRunId = this.client.testRuns.createTestRun();
9
9
  }
10
10
  }
11
11
  exports.SecondStrategy = SecondStrategy;
@@ -1,6 +1,5 @@
1
- import { IClient } from "../client";
2
1
  import { AdapterConfig } from "../common";
3
2
  import { IStrategy } from "./strategy.type";
4
3
  export declare class StrategyFactory {
5
- static create(client: IClient, config: AdapterConfig): IStrategy;
4
+ static create(config: AdapterConfig): IStrategy;
6
5
  }
@@ -5,12 +5,12 @@ const zero_strategy_1 = require("./zero.strategy");
5
5
  const first_strategy_1 = require("./first.strategy");
6
6
  const second_strategy_1 = require("./second.strategy");
7
7
  class StrategyFactory {
8
- static create(client, config) {
8
+ static create(config) {
9
9
  var _a;
10
10
  const strategies = {
11
- 0: () => new zero_strategy_1.ZeroStrategy(client, config),
12
- 1: () => new first_strategy_1.FirstStrategy(client, config),
13
- 2: () => new second_strategy_1.SecondStrategy(client, config),
11
+ 0: () => new zero_strategy_1.ZeroStrategy(config),
12
+ 1: () => new first_strategy_1.FirstStrategy(config),
13
+ 2: () => new second_strategy_1.SecondStrategy(config),
14
14
  };
15
15
  if (config.adapterMode !== undefined && (config.adapterMode > 2 || config.adapterMode < 0)) {
16
16
  throw new Error("Unknown adapter mode. Use mode 0, 1 or 2!");
@@ -1,6 +1,6 @@
1
- import { AutotestPost, AutotestResult, AutotestResultGet } from "../services";
1
+ import { AutotestPost, AutotestResult, AutotestResultGet, TestRunId } from "../services";
2
2
  export interface IStrategy {
3
- readonly testRunId: Promise<string>;
3
+ readonly testRunId: Promise<TestRunId>;
4
4
  readonly testsInRun?: Promise<AutotestResultGet[] | undefined>;
5
5
  setup(): Promise<void>;
6
6
  teardown(): Promise<void>;
@@ -1,9 +1,8 @@
1
- import { IClient } from "../client";
2
1
  import { AdapterConfig } from "../common";
3
2
  import { AutotestResultGet } from "../services";
4
3
  import { IStrategy } from "./strategy.type";
5
4
  import { BaseStrategy } from "./base.strategy";
6
5
  export declare class ZeroStrategy extends BaseStrategy implements IStrategy {
7
6
  readonly testsInRun: Promise<AutotestResultGet[] | undefined>;
8
- constructor(client: IClient, config: AdapterConfig);
7
+ constructor(config: AdapterConfig);
9
8
  }
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ZeroStrategy = void 0;
4
4
  const base_strategy_1 = require("./base.strategy");
5
5
  class ZeroStrategy extends base_strategy_1.BaseStrategy {
6
- constructor(client, config) {
7
- super(client, config);
6
+ constructor(config) {
7
+ super(config);
8
8
  if (!config.testRunId)
9
9
  throw new Error("testRunId is required when mode is 0");
10
- this.testsInRun = client.testRuns.getAutotests(config.testRunId);
10
+ this.testsInRun = this.client.testRuns.getAutotests(config.testRunId);
11
11
  }
12
12
  }
13
13
  exports.ZeroStrategy = ZeroStrategy;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testit-js-commons",
3
- "version": "2.2.6",
3
+ "version": "3.0.0",
4
4
  "description": "JavaScript commons for Test IT",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "dotenv": "^16.0.3",
28
- "testit-api-client": "~5.0.0"
28
+ "testit-api-client": "~5.1.0"
29
29
  },
30
30
  "files": [
31
31
  "lib"