qase-javascript-commons 2.0.0-beta.0 → 2.0.0-beta.1

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.
Files changed (73) hide show
  1. package/dist/config/config-loader-interface.d.ts +4 -0
  2. package/dist/config/config-loader-interface.js +2 -0
  3. package/dist/config/config-loader.d.ts +10 -0
  4. package/dist/config/config-loader.js +58 -0
  5. package/dist/config/config-type.d.ts +2 -0
  6. package/dist/config/config-type.js +2 -0
  7. package/dist/config/config-validation-schema.d.ts +6 -0
  8. package/dist/config/config-validation-schema.js +133 -0
  9. package/dist/config/index.d.ts +4 -0
  10. package/dist/config/index.js +7 -0
  11. package/dist/env/env-enum.d.ts +40 -0
  12. package/dist/env/env-enum.js +48 -0
  13. package/dist/env/env-to-config.d.ts +7 -0
  14. package/dist/env/env-to-config.js +39 -0
  15. package/dist/env/env-type.d.ts +19 -0
  16. package/dist/env/env-type.js +3 -0
  17. package/dist/env/env-validation-schema.d.ts +6 -0
  18. package/dist/env/env-validation-schema.js +74 -0
  19. package/dist/env/index.d.ts +4 -0
  20. package/dist/env/index.js +13 -0
  21. package/dist/formatter/formatter-interface.d.ts +3 -0
  22. package/dist/formatter/formatter-interface.js +2 -0
  23. package/dist/formatter/index.d.ts +2 -0
  24. package/dist/formatter/index.js +5 -0
  25. package/dist/formatter/json-formatter.d.ts +13 -0
  26. package/dist/formatter/json-formatter.js +27 -0
  27. package/dist/index.d.ts +9 -0
  28. package/dist/index.js +25 -0
  29. package/dist/models/index.d.ts +2 -0
  30. package/dist/models/index.js +7 -0
  31. package/dist/models/test-result.d.ts +25 -0
  32. package/dist/models/test-result.js +15 -0
  33. package/dist/models/test-step.d.ts +14 -0
  34. package/dist/models/test-step.js +9 -0
  35. package/dist/options/composeOptions.d.ts +9 -0
  36. package/dist/options/composeOptions.js +12 -0
  37. package/dist/options/index.d.ts +3 -0
  38. package/dist/options/index.js +7 -0
  39. package/dist/options/mode-enum.d.ts +8 -0
  40. package/dist/options/mode-enum.js +12 -0
  41. package/dist/options/options-type.d.ts +31 -0
  42. package/dist/options/options-type.js +3 -0
  43. package/dist/qase.d.ts +53 -0
  44. package/dist/qase.js +180 -0
  45. package/dist/reporters/abstract-reporter.d.ts +68 -0
  46. package/dist/reporters/abstract-reporter.js +101 -0
  47. package/dist/reporters/index.d.ts +3 -0
  48. package/dist/reporters/index.js +9 -0
  49. package/dist/reporters/report-reporter.d.ts +31 -0
  50. package/dist/reporters/report-reporter.js +40 -0
  51. package/dist/reporters/testops-reporter.d.ts +136 -0
  52. package/dist/reporters/testops-reporter.js +300 -0
  53. package/dist/utils/custom-boundary.d.ts +26 -0
  54. package/dist/utils/custom-boundary.js +30 -0
  55. package/dist/utils/disabled-exception.d.ts +6 -0
  56. package/dist/utils/disabled-exception.js +10 -0
  57. package/dist/utils/get-package-version.d.ts +5 -0
  58. package/dist/utils/get-package-version.js +25 -0
  59. package/dist/utils/is-axios-error.d.ts +6 -0
  60. package/dist/utils/is-axios-error.js +11 -0
  61. package/dist/utils/qase-error.d.ts +18 -0
  62. package/dist/utils/qase-error.js +15 -0
  63. package/dist/utils/validate-json.d.ts +20 -0
  64. package/dist/utils/validate-json.js +40 -0
  65. package/dist/writer/driver-enum.d.ts +6 -0
  66. package/dist/writer/driver-enum.js +10 -0
  67. package/dist/writer/fs-writer.d.ts +26 -0
  68. package/dist/writer/fs-writer.js +59 -0
  69. package/dist/writer/index.d.ts +3 -0
  70. package/dist/writer/index.js +7 -0
  71. package/dist/writer/writer-interface.d.ts +4 -0
  72. package/dist/writer/writer-interface.js +2 -0
  73. package/package.json +2 -2
@@ -0,0 +1,4 @@
1
+ import { ConfigType } from './config-type';
2
+ export interface ConfigLoaderInterface<T extends Partial<ConfigType>> {
3
+ load(files: string[]): (T & ConfigType) | null;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { JSONSchemaType } from 'ajv';
2
+ import { ConfigLoaderInterface } from './config-loader-interface';
3
+ import { ConfigType } from './config-type';
4
+ export declare class ConfigLoader<T extends Partial<ConfigType> & Record<string, unknown>> implements ConfigLoaderInterface<T> {
5
+ private paths;
6
+ private validationSchema;
7
+ constructor(validationSchema?: JSONSchemaType<T>, paths?: string[]);
8
+ private read;
9
+ load(): (T & ConfigType) | null;
10
+ }
@@ -0,0 +1,58 @@
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.ConfigLoader = void 0;
7
+ const fs_1 = require("fs");
8
+ const path_1 = require("path");
9
+ const lodash_merge_1 = __importDefault(require("lodash.merge"));
10
+ const qase_error_1 = require("../utils/qase-error");
11
+ const validate_json_1 = require("../utils/validate-json");
12
+ const config_validation_schema_1 = require("./config-validation-schema");
13
+ class ConfigLoader {
14
+ constructor(validationSchema, paths = ['qase.config.json', '.qaserc']) {
15
+ this.paths = paths;
16
+ this.validationSchema = (0, lodash_merge_1.default)({}, config_validation_schema_1.configValidationSchema, validationSchema);
17
+ }
18
+ read() {
19
+ for (const path of this.paths) {
20
+ const filePath = (0, path_1.join)(process.cwd(), path);
21
+ try {
22
+ return (0, fs_1.readFileSync)(filePath, 'utf8');
23
+ }
24
+ catch (error) {
25
+ const isNotFound = error instanceof Error &&
26
+ 'code' in error &&
27
+ (error.code === 'ENOENT' || error.code === 'EISDIR');
28
+ if (!isNotFound) {
29
+ throw new qase_error_1.QaseError('Cannot read config file', { cause: error });
30
+ }
31
+ }
32
+ }
33
+ return null;
34
+ }
35
+ load() {
36
+ try {
37
+ const data = this.read();
38
+ if (data) {
39
+ const json = JSON.parse(data);
40
+ (0, validate_json_1.validateJson)(this.validationSchema, json);
41
+ return json;
42
+ }
43
+ }
44
+ catch (error) {
45
+ if (error instanceof validate_json_1.JsonValidationError) {
46
+ const [validationError] = error.validationErrors;
47
+ const { instancePath = '', message = '' } = validationError ?? {};
48
+ const configPath = instancePath
49
+ ? `\`${instancePath.substring(1).replace('/', '.')}\``
50
+ : 'it';
51
+ throw new Error(`Invalid config: "${configPath}" ${message}`);
52
+ }
53
+ throw error;
54
+ }
55
+ return null;
56
+ }
57
+ }
58
+ exports.ConfigLoader = ConfigLoader;
@@ -0,0 +1,2 @@
1
+ import { OptionsType } from '../options';
2
+ export type ConfigType = Omit<OptionsType, 'frameworkPackage' | 'frameworkName' | 'reporterName'>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import { JSONSchemaType } from 'ajv';
2
+ import { ConfigType } from './config-type';
3
+ /**
4
+ * @type {JSONSchemaType<ConfigType>}
5
+ */
6
+ export declare const configValidationSchema: JSONSchemaType<ConfigType>;
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configValidationSchema = void 0;
4
+ const options_1 = require("../options");
5
+ const writer_1 = require("../writer");
6
+ /**
7
+ * @type {JSONSchemaType<ConfigType>}
8
+ */
9
+ exports.configValidationSchema = {
10
+ type: 'object',
11
+ properties: {
12
+ mode: {
13
+ type: 'string',
14
+ enum: [options_1.ModeEnum.report, options_1.ModeEnum.testops, options_1.ModeEnum.off],
15
+ nullable: true,
16
+ },
17
+ debug: {
18
+ type: 'boolean',
19
+ nullable: true,
20
+ },
21
+ environment: {
22
+ type: ['string', 'number'],
23
+ nullable: true,
24
+ },
25
+ testops: {
26
+ type: 'object',
27
+ nullable: true,
28
+ properties: {
29
+ api: {
30
+ type: 'object',
31
+ nullable: true,
32
+ properties: {
33
+ token: {
34
+ type: 'string',
35
+ nullable: true,
36
+ },
37
+ baseUrl: {
38
+ type: 'string',
39
+ nullable: true,
40
+ },
41
+ headers: {
42
+ type: 'object',
43
+ nullable: true,
44
+ additionalProperties: false,
45
+ patternProperties: {
46
+ '^.*$': {
47
+ type: 'string',
48
+ },
49
+ },
50
+ },
51
+ retries: {
52
+ type: 'number',
53
+ nullable: true,
54
+ },
55
+ retryDelay: {
56
+ type: 'number',
57
+ nullable: true,
58
+ },
59
+ },
60
+ },
61
+ project: {
62
+ type: 'string',
63
+ nullable: true,
64
+ },
65
+ uploadAttachments: {
66
+ type: 'boolean',
67
+ nullable: true,
68
+ },
69
+ baseUrl: {
70
+ type: 'string',
71
+ nullable: true,
72
+ },
73
+ run: {
74
+ type: 'object',
75
+ nullable: true,
76
+ properties: {
77
+ id: {
78
+ type: 'number',
79
+ nullable: true,
80
+ },
81
+ title: {
82
+ type: 'string',
83
+ nullable: true,
84
+ },
85
+ description: {
86
+ type: 'string',
87
+ nullable: true,
88
+ },
89
+ complete: {
90
+ type: 'boolean',
91
+ nullable: true,
92
+ },
93
+ environment: {
94
+ type: 'number',
95
+ nullable: true,
96
+ },
97
+ },
98
+ },
99
+ },
100
+ },
101
+ report: {
102
+ type: 'object',
103
+ nullable: true,
104
+ properties: {
105
+ driver: {
106
+ type: 'string',
107
+ enum: [writer_1.DriverEnum.local],
108
+ nullable: true,
109
+ },
110
+ connections: {
111
+ type: 'object',
112
+ nullable: true,
113
+ properties: {
114
+ [writer_1.DriverEnum.local]: {
115
+ type: 'object',
116
+ nullable: true,
117
+ properties: {
118
+ path: {
119
+ type: 'string',
120
+ nullable: true,
121
+ },
122
+ ext: {
123
+ type: 'string',
124
+ nullable: true,
125
+ },
126
+ },
127
+ },
128
+ },
129
+ },
130
+ },
131
+ },
132
+ },
133
+ };
@@ -0,0 +1,4 @@
1
+ export { type ConfigType } from './config-type';
2
+ export { configValidationSchema } from './config-validation-schema';
3
+ export { type ConfigLoaderInterface } from './config-loader-interface';
4
+ export { ConfigLoader } from './config-loader';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConfigLoader = exports.configValidationSchema = void 0;
4
+ var config_validation_schema_1 = require("./config-validation-schema");
5
+ Object.defineProperty(exports, "configValidationSchema", { enumerable: true, get: function () { return config_validation_schema_1.configValidationSchema; } });
6
+ var config_loader_1 = require("./config-loader");
7
+ Object.defineProperty(exports, "ConfigLoader", { enumerable: true, get: function () { return config_loader_1.ConfigLoader; } });
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @enum {string}
3
+ */
4
+ export declare enum EnvEnum {
5
+ mode = "QASE_MODE",
6
+ debug = "QASE_DEBUG",
7
+ environment = "QASE_ENVIRONMENT"
8
+ }
9
+ /**
10
+ * @enum {string}
11
+ */
12
+ export declare enum EnvTestOpsEnum {
13
+ project = "QASE_TESTOPS_PROJECT",
14
+ baseUrl = "QASE_TESTOPS_BASE_URL",
15
+ uploadAttachments = "QASE_TESTOPS_UPLOAD_ATTACHMENTS"
16
+ }
17
+ /**
18
+ * @enum {string}
19
+ */
20
+ export declare enum EnvApiEnum {
21
+ token = "QASE_TESTOPS_API_TOKEN",
22
+ baseUrl = "QASE_TESTOPS_API_BASE_URL"
23
+ }
24
+ /**
25
+ * @enum {string}
26
+ */
27
+ export declare enum EnvRunEnum {
28
+ id = "QASE_TESTOPS_RUN_ID",
29
+ title = "QASE_TESTOPS_RUN_TITLE",
30
+ description = "QASE_TESTOPS_RUN_DESCRIPTION",
31
+ complete = "QASE_TESTOPS_RUN_COMPLETE",
32
+ environment = "QASE_TESTOPS_ENVIRONMENT"
33
+ }
34
+ /**
35
+ * @enum {string}
36
+ */
37
+ export declare enum EnvLocalEnum {
38
+ path = "QASE_REPORT_CONNECTIONS_LOCAL_PATH",
39
+ ext = "QASE_REPORT_CONNECTIONS_LOCAL_EXT"
40
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnvLocalEnum = exports.EnvRunEnum = exports.EnvApiEnum = exports.EnvTestOpsEnum = exports.EnvEnum = void 0;
4
+ /**
5
+ * @enum {string}
6
+ */
7
+ var EnvEnum;
8
+ (function (EnvEnum) {
9
+ EnvEnum["mode"] = "QASE_MODE";
10
+ EnvEnum["debug"] = "QASE_DEBUG";
11
+ EnvEnum["environment"] = "QASE_ENVIRONMENT";
12
+ })(EnvEnum || (exports.EnvEnum = EnvEnum = {}));
13
+ /**
14
+ * @enum {string}
15
+ */
16
+ var EnvTestOpsEnum;
17
+ (function (EnvTestOpsEnum) {
18
+ EnvTestOpsEnum["project"] = "QASE_TESTOPS_PROJECT";
19
+ EnvTestOpsEnum["baseUrl"] = "QASE_TESTOPS_BASE_URL";
20
+ EnvTestOpsEnum["uploadAttachments"] = "QASE_TESTOPS_UPLOAD_ATTACHMENTS";
21
+ })(EnvTestOpsEnum || (exports.EnvTestOpsEnum = EnvTestOpsEnum = {}));
22
+ /**
23
+ * @enum {string}
24
+ */
25
+ var EnvApiEnum;
26
+ (function (EnvApiEnum) {
27
+ EnvApiEnum["token"] = "QASE_TESTOPS_API_TOKEN";
28
+ EnvApiEnum["baseUrl"] = "QASE_TESTOPS_API_BASE_URL";
29
+ })(EnvApiEnum || (exports.EnvApiEnum = EnvApiEnum = {}));
30
+ /**
31
+ * @enum {string}
32
+ */
33
+ var EnvRunEnum;
34
+ (function (EnvRunEnum) {
35
+ EnvRunEnum["id"] = "QASE_TESTOPS_RUN_ID";
36
+ EnvRunEnum["title"] = "QASE_TESTOPS_RUN_TITLE";
37
+ EnvRunEnum["description"] = "QASE_TESTOPS_RUN_DESCRIPTION";
38
+ EnvRunEnum["complete"] = "QASE_TESTOPS_RUN_COMPLETE";
39
+ EnvRunEnum["environment"] = "QASE_TESTOPS_ENVIRONMENT";
40
+ })(EnvRunEnum || (exports.EnvRunEnum = EnvRunEnum = {}));
41
+ /**
42
+ * @enum {string}
43
+ */
44
+ var EnvLocalEnum;
45
+ (function (EnvLocalEnum) {
46
+ EnvLocalEnum["path"] = "QASE_REPORT_CONNECTIONS_LOCAL_PATH";
47
+ EnvLocalEnum["ext"] = "QASE_REPORT_CONNECTIONS_LOCAL_EXT";
48
+ })(EnvLocalEnum || (exports.EnvLocalEnum = EnvLocalEnum = {}));
@@ -0,0 +1,7 @@
1
+ import { EnvType } from './env-type';
2
+ import { ConfigType } from '../config';
3
+ /**
4
+ * @param {EnvType} env
5
+ * @returns {ConfigType}
6
+ */
7
+ export declare const envToConfig: (env: EnvType) => ConfigType;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.envToConfig = void 0;
4
+ const env_enum_1 = require("./env-enum");
5
+ const writer_1 = require("../writer");
6
+ /**
7
+ * @param {EnvType} env
8
+ * @returns {ConfigType}
9
+ */
10
+ const envToConfig = (env) => ({
11
+ mode: env[env_enum_1.EnvEnum.mode],
12
+ debug: env[env_enum_1.EnvEnum.debug],
13
+ environment: env[env_enum_1.EnvEnum.environment],
14
+ testops: {
15
+ project: env[env_enum_1.EnvTestOpsEnum.project],
16
+ baseUrl: env[env_enum_1.EnvTestOpsEnum.baseUrl],
17
+ uploadAttachments: env[env_enum_1.EnvTestOpsEnum.uploadAttachments],
18
+ api: {
19
+ token: env[env_enum_1.EnvApiEnum.token],
20
+ baseUrl: env[env_enum_1.EnvApiEnum.baseUrl],
21
+ },
22
+ run: {
23
+ id: env[env_enum_1.EnvRunEnum.id],
24
+ title: env[env_enum_1.EnvRunEnum.title],
25
+ description: env[env_enum_1.EnvRunEnum.description],
26
+ complete: env[env_enum_1.EnvRunEnum.complete],
27
+ environment: env[env_enum_1.EnvRunEnum.environment],
28
+ },
29
+ },
30
+ report: {
31
+ connections: {
32
+ [writer_1.DriverEnum.local]: {
33
+ path: env[env_enum_1.EnvLocalEnum.path],
34
+ ext: env[env_enum_1.EnvLocalEnum.ext],
35
+ },
36
+ },
37
+ },
38
+ });
39
+ exports.envToConfig = envToConfig;
@@ -0,0 +1,19 @@
1
+ import { EnvEnum, EnvTestOpsEnum, EnvApiEnum, EnvRunEnum, EnvLocalEnum } from './env-enum';
2
+ import { ModeEnum } from '../options';
3
+ export type EnvType = {
4
+ [EnvEnum.mode]?: `${ModeEnum}`;
5
+ [EnvEnum.debug]?: boolean;
6
+ [EnvEnum.environment]?: string | number;
7
+ [EnvTestOpsEnum.project]?: string;
8
+ [EnvTestOpsEnum.baseUrl]?: string;
9
+ [EnvTestOpsEnum.uploadAttachments]?: boolean;
10
+ [EnvApiEnum.token]?: string;
11
+ [EnvApiEnum.baseUrl]?: string;
12
+ [EnvRunEnum.id]?: number;
13
+ [EnvRunEnum.title]?: string;
14
+ [EnvRunEnum.description]?: string;
15
+ [EnvRunEnum.complete]?: boolean;
16
+ [EnvRunEnum.environment]?: number;
17
+ [EnvLocalEnum.path]?: string;
18
+ [EnvLocalEnum.ext]?: string;
19
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const env_enum_1 = require("./env-enum");
@@ -0,0 +1,6 @@
1
+ import { JSONSchemaType } from 'env-schema';
2
+ import { EnvType } from './env-type';
3
+ /**
4
+ * @type {JSONSchemaType<EnvType>}
5
+ */
6
+ export declare const envValidationSchema: JSONSchemaType<EnvType>;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.envValidationSchema = void 0;
4
+ const env_enum_1 = require("./env-enum");
5
+ const options_1 = require("../options");
6
+ /**
7
+ * @type {JSONSchemaType<EnvType>}
8
+ */
9
+ exports.envValidationSchema = {
10
+ type: 'object',
11
+ properties: {
12
+ [env_enum_1.EnvEnum.mode]: {
13
+ type: 'string',
14
+ enum: [options_1.ModeEnum.report, options_1.ModeEnum.testops, options_1.ModeEnum.off],
15
+ nullable: true,
16
+ },
17
+ [env_enum_1.EnvEnum.debug]: {
18
+ type: 'boolean',
19
+ nullable: true,
20
+ },
21
+ [env_enum_1.EnvEnum.environment]: {
22
+ type: ['string', 'number'],
23
+ nullable: true,
24
+ },
25
+ [env_enum_1.EnvTestOpsEnum.project]: {
26
+ type: 'string',
27
+ nullable: true,
28
+ },
29
+ [env_enum_1.EnvTestOpsEnum.uploadAttachments]: {
30
+ type: 'boolean',
31
+ nullable: true,
32
+ },
33
+ [env_enum_1.EnvTestOpsEnum.baseUrl]: {
34
+ type: 'string',
35
+ nullable: true,
36
+ },
37
+ [env_enum_1.EnvApiEnum.token]: {
38
+ type: 'string',
39
+ nullable: true,
40
+ },
41
+ [env_enum_1.EnvApiEnum.baseUrl]: {
42
+ type: 'string',
43
+ nullable: true,
44
+ },
45
+ [env_enum_1.EnvRunEnum.id]: {
46
+ type: 'number',
47
+ nullable: true,
48
+ },
49
+ [env_enum_1.EnvRunEnum.title]: {
50
+ type: 'string',
51
+ nullable: true,
52
+ },
53
+ [env_enum_1.EnvRunEnum.description]: {
54
+ type: 'string',
55
+ nullable: true,
56
+ },
57
+ [env_enum_1.EnvRunEnum.complete]: {
58
+ type: 'boolean',
59
+ nullable: true,
60
+ },
61
+ [env_enum_1.EnvRunEnum.environment]: {
62
+ type: 'number',
63
+ nullable: true,
64
+ },
65
+ [env_enum_1.EnvLocalEnum.path]: {
66
+ type: 'string',
67
+ nullable: true,
68
+ },
69
+ [env_enum_1.EnvLocalEnum.ext]: {
70
+ type: 'string',
71
+ nullable: true,
72
+ },
73
+ },
74
+ };
@@ -0,0 +1,4 @@
1
+ export { EnvEnum, EnvTestOpsEnum, EnvApiEnum, EnvRunEnum, EnvLocalEnum, } from './env-enum';
2
+ export { type EnvType } from './env-type';
3
+ export { envValidationSchema } from './env-validation-schema';
4
+ export { envToConfig } from './env-to-config';
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.envToConfig = exports.envValidationSchema = exports.EnvLocalEnum = exports.EnvRunEnum = exports.EnvApiEnum = exports.EnvTestOpsEnum = exports.EnvEnum = void 0;
4
+ var env_enum_1 = require("./env-enum");
5
+ Object.defineProperty(exports, "EnvEnum", { enumerable: true, get: function () { return env_enum_1.EnvEnum; } });
6
+ Object.defineProperty(exports, "EnvTestOpsEnum", { enumerable: true, get: function () { return env_enum_1.EnvTestOpsEnum; } });
7
+ Object.defineProperty(exports, "EnvApiEnum", { enumerable: true, get: function () { return env_enum_1.EnvApiEnum; } });
8
+ Object.defineProperty(exports, "EnvRunEnum", { enumerable: true, get: function () { return env_enum_1.EnvRunEnum; } });
9
+ Object.defineProperty(exports, "EnvLocalEnum", { enumerable: true, get: function () { return env_enum_1.EnvLocalEnum; } });
10
+ var env_validation_schema_1 = require("./env-validation-schema");
11
+ Object.defineProperty(exports, "envValidationSchema", { enumerable: true, get: function () { return env_validation_schema_1.envValidationSchema; } });
12
+ var env_to_config_1 = require("./env-to-config");
13
+ Object.defineProperty(exports, "envToConfig", { enumerable: true, get: function () { return env_to_config_1.envToConfig; } });
@@ -0,0 +1,3 @@
1
+ export interface FormatterInterface {
2
+ format(result: unknown): Promise<string>;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export { type FormatterInterface } from './formatter-interface';
2
+ export { JsonFormatter } from './json-formatter';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonFormatter = void 0;
4
+ var json_formatter_1 = require("./json-formatter");
5
+ Object.defineProperty(exports, "JsonFormatter", { enumerable: true, get: function () { return json_formatter_1.JsonFormatter; } });
@@ -0,0 +1,13 @@
1
+ import { FormatterInterface } from './formatter-interface';
2
+ export type JsonFormatterOptionsType = {
3
+ space?: number | undefined;
4
+ };
5
+ /**
6
+ * @class JsonFormatter
7
+ * @implements FormatterInterface
8
+ */
9
+ export declare class JsonFormatter implements FormatterInterface {
10
+ private space;
11
+ constructor(options?: JsonFormatterOptionsType);
12
+ format(object: unknown): Promise<string>;
13
+ }
@@ -0,0 +1,27 @@
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.JsonFormatter = void 0;
7
+ const strip_ansi_1 = __importDefault(require("strip-ansi"));
8
+ /**
9
+ * @class JsonFormatter
10
+ * @implements FormatterInterface
11
+ */
12
+ class JsonFormatter {
13
+ constructor(options = {}) {
14
+ const { space = 4 } = options;
15
+ this.space = space;
16
+ }
17
+ // eslint-disable-next-line @typescript-eslint/require-await
18
+ async format(object) {
19
+ return JSON.stringify(object, (key, value) => {
20
+ if (key === 'error' && value instanceof Error) {
21
+ return (0, strip_ansi_1.default)(String(value));
22
+ }
23
+ return value;
24
+ }, this.space);
25
+ }
26
+ }
27
+ exports.JsonFormatter = JsonFormatter;
@@ -0,0 +1,9 @@
1
+ export * from './qase';
2
+ export * from './config';
3
+ export * from './env';
4
+ export * from './formatter';
5
+ export * from './models';
6
+ export * from './options';
7
+ export * from './reporters';
8
+ export * from './writer';
9
+ export * from './utils/get-package-version';
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./qase"), exports);
18
+ __exportStar(require("./config"), exports);
19
+ __exportStar(require("./env"), exports);
20
+ __exportStar(require("./formatter"), exports);
21
+ __exportStar(require("./models"), exports);
22
+ __exportStar(require("./options"), exports);
23
+ __exportStar(require("./reporters"), exports);
24
+ __exportStar(require("./writer"), exports);
25
+ __exportStar(require("./utils/get-package-version"), exports);
@@ -0,0 +1,2 @@
1
+ export { type TestResultType, TestStatusEnum as TestStatusEnum, } from './test-result';
2
+ export { type TestStepType, StepStatusEnum } from './test-step';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StepStatusEnum = exports.TestStatusEnum = void 0;
4
+ var test_result_1 = require("./test-result");
5
+ Object.defineProperty(exports, "TestStatusEnum", { enumerable: true, get: function () { return test_result_1.TestStatusEnum; } });
6
+ var test_step_1 = require("./test-step");
7
+ Object.defineProperty(exports, "StepStatusEnum", { enumerable: true, get: function () { return test_step_1.StepStatusEnum; } });
@@ -0,0 +1,25 @@
1
+ import { TestStepType } from './test-step';
2
+ /**
3
+ * @enum {string}
4
+ */
5
+ export declare enum TestStatusEnum {
6
+ passed = "passed",
7
+ failed = "failed",
8
+ skipped = "skipped",
9
+ disabled = "disabled",
10
+ blocked = "blocked",
11
+ invalid = "invalid"
12
+ }
13
+ export type TestResultType = {
14
+ id: string;
15
+ testOpsId: number[];
16
+ title: string;
17
+ status: `${TestStatusEnum}`;
18
+ suiteTitle?: string | string[] | undefined;
19
+ error?: Error | undefined;
20
+ startTime?: number | undefined;
21
+ duration?: number | undefined;
22
+ endTime?: number | undefined;
23
+ steps?: TestStepType[] | undefined;
24
+ attachments?: string[] | undefined;
25
+ };