cucumberjs-qase-reporter 2.0.1 → 2.0.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,17 @@
1
+ # qase-cucumberjs@2.0.2
2
+
3
+ ## What's new
4
+
5
+ - Support `QaseIgnore` tag. If the test case has the `QaseIgnore` tag, the reporter will not send the result to the Qase
6
+ TMS.
7
+
8
+ ```cucumber
9
+ @QaseIgnore
10
+ Scenario: simple test
11
+ ```
12
+
13
+ - Improved error handling.
14
+
1
15
  # qase-cucumberjs@2.0.0
2
16
 
3
17
  ## What's new
package/dist/models.d.ts CHANGED
@@ -2,4 +2,5 @@ interface TestMetadata {
2
2
  ids: number[];
3
3
  fields: Record<string, string>;
4
4
  title: string | null;
5
+ isIgnore: boolean;
5
6
  }
package/dist/storage.d.ts CHANGED
@@ -103,5 +103,6 @@ export declare class Storage {
103
103
  * @private
104
104
  */
105
105
  private getSignature;
106
+ private getError;
106
107
  }
107
108
  export {};
package/dist/storage.js CHANGED
@@ -7,6 +7,7 @@ const qaseIdRegExp = /^@[Qq]-?(\d+)$/g;
7
7
  const newQaseIdRegExp = /^@[Qq]ase[Ii][Dd]=(\d+)$/g;
8
8
  const qaseTitleRegExp = /^@[Qq]ase[Tt]itle=(.+)$/g;
9
9
  const qaseFieldsRegExp = /^@[Qq]ase[Ff]ields:(.+?)=(.+)$/g;
10
+ const qaseIgnoreRegExp = /^@[Qq]ase[Ii][Gg][Nn][Oo][Rr][Ee]$/g;
10
11
  class Storage {
11
12
  constructor() {
12
13
  /**
@@ -150,10 +151,11 @@ class Storage {
150
151
  if (!pickle) {
151
152
  return undefined;
152
153
  }
153
- let error;
154
- if (this.testCaseStartedErrors[tcs.id]?.length) {
155
- error = new Error(this.testCaseStartedErrors[tcs.id]?.join('\n\n'));
154
+ const metadata = this.parseTags(pickle.tags);
155
+ if (metadata.isIgnore) {
156
+ return undefined;
156
157
  }
158
+ const error = this.getError(tcs.id);
157
159
  let relations = null;
158
160
  const nodeId = pickle.astNodeIds[pickle.astNodeIds.length - 1];
159
161
  if (nodeId != undefined && this.scenarios[nodeId] != undefined) {
@@ -168,7 +170,6 @@ class Storage {
168
170
  },
169
171
  };
170
172
  }
171
- const metadata = this.parseTags(pickle.tags);
172
173
  return {
173
174
  attachments: [],
174
175
  author: null,
@@ -177,11 +178,11 @@ class Storage {
177
178
  start_time: null,
178
179
  end_time: null,
179
180
  duration: Math.abs(testCase.timestamp.seconds - tcs.timestamp.seconds),
180
- stacktrace: error?.stack ?? null,
181
+ stacktrace: error?.stacktrace ?? null,
181
182
  thread: null,
182
183
  },
183
184
  fields: metadata.fields,
184
- message: null,
185
+ message: error?.message ?? null,
185
186
  muted: false,
186
187
  params: {},
187
188
  group_params: {},
@@ -239,6 +240,7 @@ class Storage {
239
240
  ids: [],
240
241
  fields: {},
241
242
  title: null,
243
+ isIgnore: false,
242
244
  };
243
245
  for (const tag of tags) {
244
246
  if (qaseIdRegExp.test(tag.name)) {
@@ -264,6 +266,9 @@ class Storage {
264
266
  // do nothing
265
267
  }
266
268
  }
269
+ if (qaseIgnoreRegExp.test(tag.name)) {
270
+ metadata.isIgnore = true;
271
+ }
267
272
  }
268
273
  return metadata;
269
274
  }
@@ -281,6 +286,18 @@ class Storage {
281
286
  }
282
287
  return signature;
283
288
  }
289
+ getError(testCaseId) {
290
+ const testErrors = this.testCaseStartedErrors[testCaseId];
291
+ if (!testErrors) {
292
+ return undefined;
293
+ }
294
+ const error = new qase_javascript_commons_1.CompoundError();
295
+ testErrors.forEach((message) => {
296
+ error.addMessage(message);
297
+ error.addStacktrace(message);
298
+ });
299
+ return error;
300
+ }
284
301
  }
285
302
  exports.Storage = Storage;
286
303
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cucumberjs-qase-reporter",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Qase TMS CucumberJS Reporter",
5
5
  "homepage": "https://github.com/qase-tms/qase-javascript",
6
6
  "main": "./dist/index.js",