cypress-qase-reporter 2.0.2 → 2.0.3

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
@@ -2,8 +2,6 @@
2
2
 
3
3
  Publish results simple and easy.
4
4
 
5
- ## How to install
6
-
7
5
  To install the latest version, run:
8
6
 
9
7
  ```sh
package/changelog.md CHANGED
@@ -1,3 +1,10 @@
1
+ # cypress-qase-reporter@2.0.3
2
+
3
+ ## What's new
4
+
5
+ Cypress doesn't finish the process after the last test.
6
+ The reporter will wait for all results to be sent to Qase and will not block the process after sending.
7
+
1
8
  # cypress-qase-reporter@2.0.2
2
9
 
3
10
  ## What's new
@@ -0,0 +1 @@
1
+ declare function runChild(): Promise<void>;
package/dist/child.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ const runChild = async () => {
3
+ setTimeout(() => {
4
+ // do nothing
5
+ }, 10000);
6
+ };
7
+ runChild();
@@ -58,8 +58,15 @@ export declare class CypressQaseReporter extends reporters.Base {
58
58
  */
59
59
  private addTestResult;
60
60
  /**
61
+ * @param {Test} test
62
+ * @param {number[]} ids
63
+ * @private
64
+ */
65
+ private getSignature;
66
+ /**
67
+ * @param {Suite} suite
61
68
  * @private
62
69
  */
63
- private preventExit;
70
+ private getFile;
64
71
  }
65
72
  export {};
package/dist/reporter.js CHANGED
@@ -6,13 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.CypressQaseReporter = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const uuid_1 = require("uuid");
9
+ const child_process_1 = require("child_process");
9
10
  const mocha_1 = require("mocha");
10
11
  const qase_javascript_commons_1 = require("qase-javascript-commons");
11
12
  const traverse_dir_1 = require("./utils/traverse-dir");
12
13
  const configSchema_1 = require("./configSchema");
13
14
  const { EVENT_TEST_FAIL, EVENT_TEST_PASS, EVENT_TEST_PENDING, EVENT_RUN_END, EVENT_RUN_BEGIN, } = mocha_1.Runner.constants;
14
- // eslint-disable-next-line @typescript-eslint/unbound-method
15
- const _exit = process.exit;
16
15
  /**
17
16
  * @class CypressQaseReporter
18
17
  * @extends reporters.Base
@@ -84,11 +83,8 @@ class CypressQaseReporter extends mocha_1.reporters.Base {
84
83
  runner.on(EVENT_RUN_BEGIN, () => this.reporter.startTestRun());
85
84
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
86
85
  runner.once(EVENT_RUN_END, async () => {
87
- this.preventExit();
88
86
  await this.reporter.publish();
89
- if (process.exitCode !== undefined) {
90
- process.exit(process.exitCode);
91
- }
87
+ (0, child_process_1.spawnSync)('node', [`${__dirname}/child.js`], { stdio: 'inherit' });
92
88
  });
93
89
  }
94
90
  /**
@@ -124,7 +120,7 @@ class CypressQaseReporter extends mocha_1.reporters.Base {
124
120
  params: {},
125
121
  relations: relations,
126
122
  run_id: null,
127
- signature: '',
123
+ signature: this.getSignature(test, ids),
128
124
  steps: [],
129
125
  id: test.id,
130
126
  execution: {
@@ -143,14 +139,39 @@ class CypressQaseReporter extends mocha_1.reporters.Base {
143
139
  void this.reporter.addTestResult(result);
144
140
  }
145
141
  /**
142
+ * @param {Test} test
143
+ * @param {number[]} ids
146
144
  * @private
147
145
  */
148
- preventExit() {
149
- const mutableProcess = process;
150
- mutableProcess.exit = (code) => {
151
- process.exitCode = code || 0;
152
- process.exit = _exit;
153
- };
146
+ getSignature(test, ids) {
147
+ let signature = '';
148
+ const file = test.parent ? this.getFile(test.parent) : undefined;
149
+ if (file) {
150
+ signature = file.split('/').join('::');
151
+ }
152
+ if (test.parent) {
153
+ for (const suite of test.parent.titlePath()) {
154
+ signature += '::' + suite.toLowerCase().replace(/\s/g, '_');
155
+ }
156
+ }
157
+ signature += '::' + test.title.toLowerCase().replace(/\s/g, '_');
158
+ if (ids.length > 0) {
159
+ signature += '::' + ids.join('::');
160
+ }
161
+ return signature;
162
+ }
163
+ /**
164
+ * @param {Suite} suite
165
+ * @private
166
+ */
167
+ getFile(suite) {
168
+ if (suite.file) {
169
+ return suite.file;
170
+ }
171
+ if (suite.parent) {
172
+ return this.getFile(suite.parent);
173
+ }
174
+ return undefined;
154
175
  }
155
176
  }
156
177
  exports.CypressQaseReporter = CypressQaseReporter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cypress-qase-reporter",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Qase Cypress Reporter",
5
5
  "homepage": "https://github.com/qase-tms/qase-javascript",
6
6
  "sideEffects": false,
@@ -5,5 +5,5 @@
5
5
  "noEmit": false
6
6
  },
7
7
 
8
- "include": ["./src/**/*.ts"]
8
+ "include": ["./src/**/*.ts", "./src/*.js"],
9
9
  }