newman-reporter-qase 1.0.7 → 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.
package/README.md CHANGED
@@ -29,22 +29,11 @@ pm.test('expect response be 200', function () {
29
29
  ```
30
30
  ### Execute rom CLI:
31
31
  ```
32
- QASE_RUN_ID=34 # Specify Run ID using ENV
33
- newman run \
34
- -r qase \ # Enable Qase logger
35
- --reporter-qase-logging \ # Use reporter logger (like debug)
36
- --reporter-qase-projectCode project_code \ # Specify Project Code
37
- --reporter-qase-apiToken api_token \ # Specify API token
38
- --reporter-qase-runId 34 \ # Specify Run ID using CLI parameters
39
- --reporter-qase-basePath https://api.qase.io/v1 \ # URL Qase.io
40
- --reporter-qase-runName 'API test Execution' \ # Specify Run name using CLI parameters
41
- --reporter-qase-runDescription 'Check API consistency' \ # Specify Run description using CLI parameters
42
- --reporter-qase-rootSuiteTitle 'Newman tests' \ # A parent suite for your autocreated tests
43
- -x # WA for issue https://github.com/postmanlabs/newman/issues/2148#issuecomment-665229759
32
+ QASE_MODE=testops newman run ./sample-collection.json -r qase
44
33
  ```
45
34
 
46
35
  <p align="center">
47
- <img width="65%" src="./examples/screenshots/screenshot.png">
36
+ <img width="65%" src="./screenshots/screenshot.png">
48
37
  </p>
49
38
 
50
39
  A test run will be performed and available at:
@@ -54,13 +43,61 @@ https://app.qase.io/run/QASE_PROJECT_CODE
54
43
  ```
55
44
 
56
45
  <p align="center">
57
- <img src="./examples/screenshots/demo.gif">
46
+ <img src="./screenshots/demo.gif">
58
47
  </p>
59
48
 
49
+ ## Configuration
50
+
51
+ Qase reporter supports passing parameters using two ways:
52
+ using `.qaserc`/`qase.config.json` file and using ENV variables.
53
+
54
+ `.qaserc` parameters, (* - required):
55
+ - `mode` - `testops`/`off` Enables reporter, default - `off`
56
+ - `debug` - Enables debug logging, defaule - `false`
57
+ - `environment` - To execute with the sending of the envinroment information
58
+ - *`testops.api.token` - Token for API access, you can find more information
59
+ [here](https://developers.qase.io/#authentication)
60
+ - *`testops.project` - Code of your project (can be extracted from main
61
+ page of your project: `https://app.qase.io/project/DEMOTR` -
62
+ `DEMOTR` is project code here)
63
+ - `testops.run.id` - Pass Run ID
64
+ - `testops.run.title` - Set custom Run name, when new run is created
65
+ - `testops.run.description` - Set custom Run description, when new run is created
66
+ - `testops.run.complete` - Whether the run should be completed
67
+
68
+ Example configuration file:
69
+
70
+ ```json
71
+ {
72
+ "mode": "testops",
73
+ "debug": true,
74
+ "environment": 1,
75
+ "testops": {
76
+ "api": {
77
+ "token": "api_key"
78
+ },
79
+ "projectCode": "project_code"
80
+ }
81
+ }
82
+ ```
83
+
84
+ Supported ENV variables:
85
+
86
+ - `QASE_MODE` - Same as `mode`
87
+ - `QASE_DEBUG` - Same as `debug`
88
+ - `QASE_ENVIRONMENT` - Same as `environment`
89
+ - `QASE_TESTOPS_API_TOKEN` - Same as `testops.api.token`
90
+ - `QASE_TESTOPS_PROJECT` - Same as `testops.project`
91
+ - `QASE_TESTOPS_RUN_ID` - Pass Run ID from ENV and override reporter option `testops.run.id`
92
+ - `QASE_TESTOPS_RUN_TITLE` - Same as `testops.run.title`
93
+ - `QASE_TESTOPS_RUN_DESCRIPTION` - Same as `testops.run.description`
94
+
60
95
  ## Requirements
61
96
 
62
97
  We maintain the reporter on LTS versions of Node. You can find the current versions by following the [link](https://nodejs.org/en/about/releases/)
63
98
 
99
+ `newman >= 5.3.0`
100
+
64
101
  <!-- references -->
65
102
 
66
103
  [auth]: https://developers.qase.io/#authentication
package/dist/index.d.ts CHANGED
@@ -1,39 +1,2 @@
1
- /// <reference types="node" />
2
- import { EventEmitter } from 'events';
3
- import { NewmanRunOptions } from 'newman';
4
- interface QaseOptions {
5
- apiToken: string;
6
- basePath?: string;
7
- rootSuiteTitle?: string;
8
- projectCode: string;
9
- runId?: string;
10
- runPrefix?: string;
11
- runName?: string;
12
- runDescription?: string;
13
- logging?: boolean;
14
- runComplete?: boolean;
15
- environmentId?: number;
16
- }
17
- declare class NewmanQaseReporter {
18
- private api;
19
- private prePending;
20
- private options;
21
- private collectionOptions;
22
- private runId?;
23
- private isDisabled;
24
- constructor(emitter: EventEmitter, _options: QaseOptions, collectionRunOptions: NewmanRunOptions);
25
- private createHeaders;
26
- private getEnv;
27
- private log;
28
- private getPackageVersion;
29
- private addRunnerListeners;
30
- private extractIds;
31
- private checkProject;
32
- private createRun;
33
- private createRunObject;
34
- private checkRun;
35
- private itemName;
36
- private logTestItem;
37
- private createBulkResultsBodyObject;
38
- }
1
+ import { NewmanQaseReporter } from './reporter';
39
2
  export = NewmanQaseReporter;
package/dist/index.js CHANGED
@@ -1,420 +1,3 @@
1
1
  "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- var __assign = (this && this.__assign) || function () {
7
- __assign = Object.assign || function(t) {
8
- for (var s, i = 1, n = arguments.length; i < n; i++) {
9
- s = arguments[i];
10
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
- t[p] = s[p];
12
- }
13
- return t;
14
- };
15
- return __assign.apply(this, arguments);
16
- };
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
33
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
- var __spreadArrays = (this && this.__spreadArrays) || function () {
54
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
55
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
56
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
57
- r[k] = a[j];
58
- return r;
59
- };
60
- var __importDefault = (this && this.__importDefault) || function (mod) {
61
- return (mod && mod.__esModule) ? mod : { "default": mod };
62
- };
63
- var src_1 = require("qaseio/dist/src");
64
- var child_process_1 = require("child_process");
65
- var qaseio_1 = require("qaseio");
66
- var chalk_1 = __importDefault(require("chalk"));
67
- var fs_1 = require("fs");
68
- var Envs;
69
- (function (Envs) {
70
- Envs["report"] = "QASE_REPORT";
71
- Envs["apiToken"] = "QASE_API_TOKEN";
72
- Envs["basePath"] = "QASE_API_BASE_URL";
73
- Envs["projectCode"] = "QASE_PROJECT_CODE";
74
- Envs["runId"] = "QASE_RUN_ID";
75
- Envs["runName"] = "QASE_RUN_NAME";
76
- Envs["runDescription"] = "QASE_RUN_DESCRIPTION";
77
- Envs["runComplete"] = "QASE_RUN_COMPLETE";
78
- Envs["environmentId"] = "QASE_ENVIRONMENT_ID";
79
- Envs["rootSuiteTitle"] = "QASE_ROOT_SUITE_TITLE";
80
- })(Envs || (Envs = {}));
81
- var NewmanQaseReporter = /** @class */ (function () {
82
- function NewmanQaseReporter(emitter, _options, collectionRunOptions) {
83
- this.prePending = {};
84
- this.isDisabled = false;
85
- this.options = _options;
86
- this.options.projectCode =
87
- _options.projectCode || this.getEnv(Envs.projectCode) || '';
88
- this.collectionOptions = collectionRunOptions;
89
- this.options.runComplete =
90
- !!this.getEnv(Envs.runComplete) || this.options.runComplete || false;
91
- this.options.environmentId = Number(this.getEnv(Envs.environmentId)) || this.options.environmentId || undefined;
92
- this.api = new qaseio_1.QaseApi(this.getEnv(Envs.apiToken) || this.options.apiToken || '', this.getEnv(Envs.basePath) || this.options.basePath, this.createHeaders());
93
- this.log(chalk_1.default(templateObject_1 || (templateObject_1 = __makeTemplateObject(["{yellow Current PID: ", "}"], ["{yellow Current PID: ", "}"])), process.pid));
94
- if (!this.options.projectCode) {
95
- return;
96
- }
97
- this.addRunnerListeners(emitter);
98
- }
99
- NewmanQaseReporter.prototype.createHeaders = function () {
100
- var nodeVersion = process.version, os = process.platform, arch = process.arch;
101
- var npmVersion = child_process_1.execSync('npm -v', { encoding: 'utf8' }).replace(/['"\n]+/g, '');
102
- var qaseapiVersion = this.getPackageVersion('qaseio');
103
- var frameworkVersion = this.getPackageVersion('newman');
104
- var reporterVersion = this.getPackageVersion('newman-reporter-qase');
105
- var xPlatformHeader = "node=" + nodeVersion + "; npm=" + npmVersion + "; os=" + os + "; arch=" + arch;
106
- // eslint-disable-next-line max-len
107
- var xClientHeader = "newman=" + frameworkVersion + "; qase-newman=" + reporterVersion + "; qaseapi=" + qaseapiVersion;
108
- return {
109
- 'X-Client': xClientHeader,
110
- 'X-Platform': xPlatformHeader,
111
- };
112
- };
113
- NewmanQaseReporter.prototype.getEnv = function (name) {
114
- return process.env[name];
115
- };
116
- NewmanQaseReporter.prototype.log = function (message) {
117
- var optionalParams = [];
118
- for (var _i = 1; _i < arguments.length; _i++) {
119
- optionalParams[_i - 1] = arguments[_i];
120
- }
121
- if (this.options.logging) {
122
- console.log.apply(console, __spreadArrays([chalk_1.default(templateObject_2 || (templateObject_2 = __makeTemplateObject(["{bold {blue qase:}} ", ""], ["{bold {blue qase:}} ", ""])), message)], optionalParams));
123
- }
124
- };
125
- NewmanQaseReporter.prototype.getPackageVersion = function (name) {
126
- var UNDEFINED = 'undefined';
127
- try {
128
- var pathToPackageJson = require.resolve(name + "/package.json", {
129
- paths: [process.cwd()],
130
- });
131
- if (pathToPackageJson) {
132
- try {
133
- var packageString = fs_1.readFileSync(pathToPackageJson, {
134
- encoding: 'utf8',
135
- });
136
- if (packageString) {
137
- var packageObject = JSON.parse(packageString);
138
- return packageObject.version;
139
- }
140
- return UNDEFINED;
141
- }
142
- catch (error) {
143
- return UNDEFINED;
144
- }
145
- }
146
- }
147
- catch (error) {
148
- return UNDEFINED;
149
- }
150
- };
151
- NewmanQaseReporter.prototype.addRunnerListeners = function (runner) {
152
- var _this = this;
153
- runner.on('start', function () {
154
- if (_this.isDisabled) {
155
- return;
156
- }
157
- });
158
- runner.on('beforeItem', function (err, args) {
159
- var item = args.item;
160
- var name = _this.itemName(args);
161
- var ids = _this.extractIds(item.events);
162
- if (name) {
163
- _this.log('Test', name, 'starting, case ids:', ids);
164
- _this.prePending[name] = {
165
- name: name,
166
- result: src_1.ResultCreateStatusEnum.PASSED,
167
- duration: 0,
168
- ids: ids,
169
- startStamp: Date.now(),
170
- };
171
- }
172
- });
173
- runner.on('request', function (err, args) {
174
- var name = _this.itemName(args);
175
- if (name && _this.prePending[name]) {
176
- _this.prePending[name].response = args.response;
177
- }
178
- });
179
- runner.on('assertion', function (err, args) {
180
- var name = _this.itemName(args);
181
- if (name && _this.prePending[name] && err) {
182
- _this.prePending[name].result = src_1.ResultCreateStatusEnum.FAILED;
183
- _this.prePending[name].err = err;
184
- }
185
- });
186
- runner.on('item', function (err, args) {
187
- var name = _this.itemName(args);
188
- if (name && _this.prePending[name]) {
189
- var item = _this.prePending[name];
190
- item.endStamp = Date.now();
191
- item.duration = item.endStamp - item.startStamp;
192
- _this.logTestItem(_this.prePending[name]);
193
- }
194
- });
195
- runner.on('beforeDone', function () {
196
- void _this.checkProject(_this.options.projectCode, function (prjExists) { return __awaiter(_this, void 0, void 0, function () {
197
- var providedRunId;
198
- var _this = this;
199
- return __generator(this, function (_a) {
200
- if (!prjExists) {
201
- this.log(chalk_1.default(templateObject_3 || (templateObject_3 = __makeTemplateObject(["{red Project ", " does not exist}"], ["{red Project ", " does not exist}"])), this.options.projectCode));
202
- this.isDisabled = true;
203
- return [2 /*return*/];
204
- }
205
- this.log(chalk_1.default(templateObject_4 || (templateObject_4 = __makeTemplateObject(["{green Project ", " exists}"], ["{green Project ", " exists}"])), this.options.projectCode));
206
- providedRunId = this.getEnv(Envs.runId) || this.options.runId;
207
- if (providedRunId) {
208
- this.runId = providedRunId;
209
- return [2 /*return*/, this.checkRun(this.runId, function (runExists) {
210
- if (runExists) {
211
- _this.log(chalk_1.default(templateObject_5 || (templateObject_5 = __makeTemplateObject(["{green Using run ", " to publish test results}"], ["{green Using run ", " to publish test results}"])), _this.runId));
212
- }
213
- else {
214
- _this.log(chalk_1.default(templateObject_6 || (templateObject_6 = __makeTemplateObject(["{red Run ", " does not exist}"], ["{red Run ", " does not exist}"])), _this.runId));
215
- _this.isDisabled = true;
216
- }
217
- })];
218
- }
219
- else {
220
- return [2 /*return*/, this.createRun(this.getEnv(Envs.runName) || this.options.runName, this.getEnv(Envs.runDescription) ||
221
- this.options.runDescription, function (created) {
222
- var _a;
223
- if (created) {
224
- _this.runId = (_a = created.result) === null || _a === void 0 ? void 0 : _a.id;
225
- process.env.QASE_RUN_ID = String(_this.runId);
226
- _this.log(chalk_1.default(templateObject_7 || (templateObject_7 = __makeTemplateObject(["{green Using run ", " to publish test results}"], ["{green Using run ", " to publish test results}"])), _this.runId));
227
- }
228
- else {
229
- _this.log(chalk_1.default(templateObject_8 || (templateObject_8 = __makeTemplateObject(["{red Could not create run in project ", "}"], ["{red Could not create run in project ", "}"])), _this.options.projectCode));
230
- _this.isDisabled = true;
231
- }
232
- })];
233
- }
234
- return [2 /*return*/];
235
- });
236
- }); }).then(function () {
237
- var config = {
238
- apiToken: _this.getEnv(Envs.apiToken) || _this.options.apiToken || '',
239
- basePath: _this.getEnv(Envs.basePath) || _this.options.basePath,
240
- headers: _this.createHeaders(),
241
- code: _this.options.projectCode,
242
- runId: Number(_this.runId),
243
- body: {
244
- results: _this.createBulkResultsBodyObject(),
245
- },
246
- runComplete: _this.options.runComplete,
247
- };
248
- child_process_1.spawnSync('node', [__dirname + "/reportBulk.js"], {
249
- stdio: 'inherit',
250
- env: Object.assign(process.env, {
251
- reporting_config: JSON.stringify(config),
252
- }),
253
- });
254
- });
255
- });
256
- runner.on('done', function () {
257
- _this.log('Done');
258
- _this.log('Run finished');
259
- });
260
- };
261
- NewmanQaseReporter.prototype.extractIds = function (eventList) {
262
- var regex = /\/\/\s?[qQ]ase:\s?((?:[\d]+[\s,]{0,})+)/g;
263
- var ids = [];
264
- eventList.each(function (event) {
265
- if (event.listen === 'test' && event.script.exec) {
266
- event.script.exec.forEach(function (line) {
267
- var m;
268
- while ((m = regex.exec(line)) !== null) {
269
- if (m.index === regex.lastIndex) {
270
- regex.lastIndex++;
271
- }
272
- m.forEach(function (match, groupIndex) {
273
- if (groupIndex === 1) {
274
- var hereIds = match.split(/[, ]/).filter(function (val) { return val !== ''; });
275
- ids.push.apply(ids, hereIds);
276
- }
277
- });
278
- }
279
- });
280
- }
281
- });
282
- return ids;
283
- };
284
- NewmanQaseReporter.prototype.checkProject = function (projectCode, cb) {
285
- var _a;
286
- return __awaiter(this, void 0, void 0, function () {
287
- var resp, err_1;
288
- return __generator(this, function (_b) {
289
- switch (_b.label) {
290
- case 0:
291
- _b.trys.push([0, 3, , 4]);
292
- return [4 /*yield*/, this.api.projects.getProject(projectCode)];
293
- case 1:
294
- resp = _b.sent();
295
- return [4 /*yield*/, cb(Boolean((_a = resp.data.result) === null || _a === void 0 ? void 0 : _a.code))];
296
- case 2:
297
- _b.sent();
298
- return [3 /*break*/, 4];
299
- case 3:
300
- err_1 = _b.sent();
301
- this.log(err_1);
302
- this.isDisabled = true;
303
- return [3 /*break*/, 4];
304
- case 4: return [2 /*return*/];
305
- }
306
- });
307
- });
308
- };
309
- NewmanQaseReporter.prototype.createRun = function (name, description, cb) {
310
- return __awaiter(this, void 0, void 0, function () {
311
- var runObject, resp, err_2;
312
- return __generator(this, function (_a) {
313
- switch (_a.label) {
314
- case 0:
315
- _a.trys.push([0, 2, , 3]);
316
- runObject = this.createRunObject(name || "Automated run " + new Date().toISOString(), [], {
317
- description: description || 'Newman automated run',
318
- is_autotest: true,
319
- environment_id: this.options.environmentId,
320
- });
321
- return [4 /*yield*/, this.api.runs.createRun(this.options.projectCode, runObject)];
322
- case 1:
323
- resp = _a.sent();
324
- cb(resp.data);
325
- return [3 /*break*/, 3];
326
- case 2:
327
- err_2 = _a.sent();
328
- this.log("Error on creating run " + err_2);
329
- this.isDisabled = true;
330
- return [3 /*break*/, 3];
331
- case 3: return [2 /*return*/];
332
- }
333
- });
334
- });
335
- };
336
- NewmanQaseReporter.prototype.createRunObject = function (name, cases, args) {
337
- return __assign({ title: name, cases: cases }, args);
338
- };
339
- NewmanQaseReporter.prototype.checkRun = function (runId, cb) {
340
- return __awaiter(this, void 0, void 0, function () {
341
- var _this = this;
342
- return __generator(this, function (_a) {
343
- if (runId === undefined) {
344
- cb(false);
345
- return [2 /*return*/];
346
- }
347
- return [2 /*return*/, this.api.runs
348
- .getRun(this.options.projectCode, Number(runId))
349
- .then(function (resp) {
350
- var _a, _b;
351
- _this.log("Get run result on checking run " + ((_a = resp.data.result) === null || _a === void 0 ? void 0 : _a.id));
352
- cb(Boolean((_b = resp.data.result) === null || _b === void 0 ? void 0 : _b.id));
353
- })
354
- .catch(function (err) {
355
- _this.log("Error on checking run " + err);
356
- _this.isDisabled = true;
357
- })];
358
- });
359
- });
360
- };
361
- NewmanQaseReporter.prototype.itemName = function (args) {
362
- if (args.item) {
363
- var item = args.item;
364
- var name_1 = item.name;
365
- return name_1;
366
- }
367
- };
368
- NewmanQaseReporter.prototype.logTestItem = function (test) {
369
- var map = {
370
- failed: chalk_1.default(templateObject_9 || (templateObject_9 = __makeTemplateObject(["{red Test ", " ", "}"], ["{red Test ", " ", "}"])), test.name, test.result),
371
- passed: chalk_1.default(templateObject_10 || (templateObject_10 = __makeTemplateObject(["{green Test ", " ", "}"], ["{green Test ", " ", "}"])), test.name, test.result),
372
- pending: chalk_1.default(templateObject_11 || (templateObject_11 = __makeTemplateObject(["{blueBright Test ", " ", "}"], ["{blueBright Test ", " ", "}"])), test.name, test.result),
373
- };
374
- if (test.result) {
375
- this.log(map[test.result]);
376
- }
377
- };
378
- NewmanQaseReporter.prototype.createBulkResultsBodyObject = function () {
379
- var _this = this;
380
- var prePandingValuesArray = Object.values(this.prePending);
381
- return prePandingValuesArray.reduce(function (accum, test) {
382
- var _a;
383
- var ids = test.ids;
384
- if (ids && ids.length > 0) {
385
- var testsByIdArray = ids.map(function (id) {
386
- var _a;
387
- return ({
388
- case_id: Number(id),
389
- status: test.result,
390
- time_ms: test.duration,
391
- stacktrace: (_a = test.err) === null || _a === void 0 ? void 0 : _a.stack,
392
- comment: test.err ? test.err.message : '',
393
- defect: test.result === src_1.ResultCreateStatusEnum.FAILED,
394
- });
395
- });
396
- return __spreadArrays(accum, testsByIdArray);
397
- }
398
- else {
399
- var testByIdArray = [
400
- {
401
- case: {
402
- title: test.name,
403
- suite_title: _this.options.rootSuiteTitle || 'Autocreated Root Suite',
404
- },
405
- status: test.result,
406
- time_ms: test.duration,
407
- stacktrace: (_a = test.err) === null || _a === void 0 ? void 0 : _a.stack,
408
- comment: test.err ? test.err.message : '',
409
- defect: test.result === src_1.ResultCreateStatusEnum.FAILED,
410
- },
411
- ];
412
- return __spreadArrays(accum, testByIdArray);
413
- }
414
- }, []);
415
- };
416
- return NewmanQaseReporter;
417
- }());
418
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11;
419
- module.exports = NewmanQaseReporter;
420
- //# sourceMappingURL=index.js.map
2
+ const reporter_1 = require("./reporter");
3
+ module.exports = reporter_1.NewmanQaseReporter;
@@ -0,0 +1,57 @@
1
+ /// <reference types="node" />
2
+ import { EventEmitter } from 'events';
3
+ import { ConfigType, ConfigLoader } from 'qase-javascript-commons';
4
+ export type NewmanQaseOptionsType = ConfigType;
5
+ /**
6
+ * @class NewmanQaseReporter
7
+ */
8
+ export declare class NewmanQaseReporter {
9
+ /**
10
+ * @type {RegExp}
11
+ */
12
+ static qaseIdRegExp: RegExp;
13
+ /**
14
+ * @param {EventList} eventList
15
+ * @returns {number[]}
16
+ * @private
17
+ */
18
+ private static getCaseIds;
19
+ /**
20
+ * @param {PropertyBase<PropertyBaseDefinition>} item
21
+ * @param {string[]} titles
22
+ * @returns {string[]}
23
+ * @private
24
+ */
25
+ private static getParentTitles;
26
+ /**
27
+ * @type {ReporterInterface}
28
+ * @private
29
+ */
30
+ private reporter;
31
+ /**
32
+ * @type {Map<string, TestResultType>}
33
+ * @private
34
+ */
35
+ private pendingResultMap;
36
+ /**
37
+ * @type {Map<string, number>}
38
+ * @private
39
+ */
40
+ private timerMap;
41
+ /**
42
+ * @param {EventEmitter} emitter
43
+ * @param {NewmanQaseOptionsType} options
44
+ * @param {unknown} _
45
+ * @param {ConfigLoaderInterface} configLoader
46
+ */
47
+ constructor(emitter: EventEmitter, options: NewmanQaseOptionsType, _: unknown, configLoader?: ConfigLoader<Partial<ConfigType> & Record<string, unknown>>);
48
+ /**
49
+ * @param {EventEmitter} runner
50
+ * @private
51
+ */
52
+ private addRunnerListeners;
53
+ /**
54
+ * @private
55
+ */
56
+ private preventExit;
57
+ }