qase-javascript-commons 2.0.0 → 2.0.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/changelog.md CHANGED
@@ -1,14 +1,26 @@
1
+ # qase-javascript-commons@2.0.1
2
+
3
+ ## What's new
4
+
5
+ Remove ANSI escape codes from the message and stack trace.
6
+ Before this fix, the reporter added ANSI escape codes to the message and stack trace.
7
+
8
+ ```diff
9
+ - Error: expect(received).toBe(expected) // Object.is equality
10
+ + Error: expect(received).toBe(expected) // Object.is equality
11
+ ```
12
+
1
13
  # qase-javascript-commons@2.0.0
2
14
 
3
15
  ## What's new
4
16
 
5
17
  This is the first release version of the Qase JavaScript SDK.
6
18
  It is numbered `2.0.0` (and not `1.0.0`) to match the release series of
7
- test reporters for Playwright, Cypress, Jest and other frameworks.
19
+ test reporters for Playwright, Cypress, Jest, and other frameworks.
8
20
 
9
21
  ### Annotating test with field data
10
22
 
11
- Tests can now be annotated with data for system and custom fields in Qase.
23
+ Tests can now be annotated with data for the system and custom fields in Qase.
12
24
  This feature is already implemented in the Playwright reporter:
13
25
 
14
26
  ```js
@@ -28,7 +40,7 @@ a standalone result, with its own run history.
28
40
  ### Attachments from files and variables
29
41
 
30
42
  Reporters can now upload attachments of various data types to Qase,
31
- both from files and from variables.
43
+ both from files and variables.
32
44
  It enables flexible and meticulous logging, such as collecting full HTTP request data,
33
45
  including URL, headers, and payload.
34
46
 
@@ -42,7 +54,8 @@ It helps bring test results faster and enables acting on them long before the te
42
54
  Qase JavaScript SDK brings configuration with config files and environment variables
43
55
  to a common standard, used with Qase reporters in all languages and frameworks.
44
56
 
45
- For details, see the Configuration section in the README.
57
+ For details, see the [Configuration](https://github.com/qase-tms/qase-javascript/tree/main/qase-javascript-commons#configuration)
58
+ section in the README.
46
59
 
47
60
  ### Latest API
48
61
 
@@ -48,4 +48,5 @@ export declare abstract class AbstractReporter implements InternalReporterInterf
48
48
  * @param {TestResultType[]} results
49
49
  */
50
50
  setTestResults(results: TestResultType[]): void;
51
+ private removeAnsiEscapeCodes;
51
52
  }
@@ -32,6 +32,12 @@ class AbstractReporter {
32
32
  // eslint-disable-next-line @typescript-eslint/require-await
33
33
  async addTestResult(result) {
34
34
  this.logger.logDebug(`Adding test result: ${JSON.stringify(result)}`);
35
+ if (result.execution.stacktrace) {
36
+ result.execution.stacktrace = this.removeAnsiEscapeCodes(result.execution.stacktrace);
37
+ }
38
+ if (result.message) {
39
+ result.message = this.removeAnsiEscapeCodes(result.message);
40
+ }
35
41
  if (result.testops_id === null || !Array.isArray(result.testops_id)) {
36
42
  this.results.push(result);
37
43
  return;
@@ -55,5 +61,11 @@ class AbstractReporter {
55
61
  setTestResults(results) {
56
62
  this.results = results;
57
63
  }
64
+ removeAnsiEscapeCodes(str) {
65
+ const ansiEscapeSequences = new RegExp([
66
+ '\x1B[[(?);]{0,2}(;?\\d)*.',
67
+ ].join('|'), 'g');
68
+ return str.replace(ansiEscapeSequences, '');
69
+ }
58
70
  }
59
71
  exports.AbstractReporter = AbstractReporter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qase-javascript-commons",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Qase JS Reporters",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  "test": "jest --passWithNoTests",
22
22
  "clean": "rm -rf dist"
23
23
  },
24
- "author": "Qase Team <dharding@dimitriharding.com>",
24
+ "author": "Qase Team <support@qase.io>",
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
27
  "ajv": "^8.12.0",