mocha-qase-reporter 1.0.0-beta.2 → 1.0.0-beta.4
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 +19 -0
- package/dist/reporter.d.ts +1 -0
- package/dist/reporter.js +16 -4
- package/dist/types.d.ts +2 -0
- package/dist/types.js +1 -0
- package/package.json +2 -2
package/changelog.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
# qase-mocha@1.0.0-beta.4
|
|
2
|
+
|
|
3
|
+
## What's new
|
|
4
|
+
|
|
5
|
+
Fixed the issue with async tests not being reported correctly.
|
|
6
|
+
|
|
7
|
+
# qase-mocha@1.0.0-beta.3
|
|
8
|
+
|
|
9
|
+
## What's new
|
|
10
|
+
|
|
11
|
+
Support group parameters for test cases. You can specify the group parameters in the test case using the following format:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
it('test', () => {
|
|
15
|
+
this.groupParameters({ param1: 'value1', param2: 'value2' });
|
|
16
|
+
expect(true).to.equal(true);
|
|
17
|
+
});
|
|
18
|
+
```
|
|
19
|
+
|
|
1
20
|
# qase-mocha@1.0.0-beta.2
|
|
2
21
|
|
|
3
22
|
## What's new
|
package/dist/reporter.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export declare class MochaQaseReporter extends reporters.Base {
|
|
|
51
51
|
qaseId: (id: number | number[]) => void;
|
|
52
52
|
title: (title: string) => void;
|
|
53
53
|
parameters: (values: Record<string, string>) => void;
|
|
54
|
+
groupParameters: (values: Record<string, string>) => void;
|
|
54
55
|
fields: (values: Record<string, string>) => void;
|
|
55
56
|
suite: (name: string) => void;
|
|
56
57
|
ignore: () => void;
|
package/dist/reporter.js
CHANGED
|
@@ -9,6 +9,7 @@ const types_1 = require("./types");
|
|
|
9
9
|
const qase_javascript_commons_1 = require("qase-javascript-commons");
|
|
10
10
|
const deasync_promise_1 = __importDefault(require("deasync-promise"));
|
|
11
11
|
const node_path_1 = require("node:path");
|
|
12
|
+
const uuid_1 = require("uuid");
|
|
12
13
|
const Events = mocha_1.Runner.constants;
|
|
13
14
|
class currentTest {
|
|
14
15
|
constructor() {
|
|
@@ -35,7 +36,8 @@ class MochaQaseReporter extends mocha_1.reporters.Base {
|
|
|
35
36
|
this.runner.on(Events.EVENT_TEST_BEGIN, (test) => this.addMethods(test.ctx));
|
|
36
37
|
this.runner.on(Events.EVENT_HOOK_BEGIN, (hook) => this.addMethods(hook.ctx));
|
|
37
38
|
this.runner.on(Events.EVENT_TEST_BEGIN, () => this.onStartTest());
|
|
38
|
-
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
40
|
+
this.runner.on(Events.EVENT_TEST_END, async (test) => await this.onEndTest(test));
|
|
39
41
|
};
|
|
40
42
|
this.qaseId = (id) => {
|
|
41
43
|
this.metadata.addQaseId(id);
|
|
@@ -50,6 +52,13 @@ class MochaQaseReporter extends mocha_1.reporters.Base {
|
|
|
50
52
|
}
|
|
51
53
|
this.metadata.parameters = stringRecord;
|
|
52
54
|
};
|
|
55
|
+
this.groupParameters = (values) => {
|
|
56
|
+
const stringRecord = {};
|
|
57
|
+
for (const [key, value] of Object.entries(values)) {
|
|
58
|
+
stringRecord[String(key)] = String(value);
|
|
59
|
+
}
|
|
60
|
+
this.metadata.groupParameters = stringRecord;
|
|
61
|
+
};
|
|
53
62
|
this.fields = (values) => {
|
|
54
63
|
const stringRecord = {};
|
|
55
64
|
for (const [key, value] of Object.entries(values)) {
|
|
@@ -108,6 +117,7 @@ class MochaQaseReporter extends mocha_1.reporters.Base {
|
|
|
108
117
|
reporterName: 'mocha-qase-reporter',
|
|
109
118
|
});
|
|
110
119
|
if (options.parallel) {
|
|
120
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
111
121
|
options.require = [...(options.require ?? []), resolveParallelModeSetupFile()];
|
|
112
122
|
}
|
|
113
123
|
else {
|
|
@@ -126,6 +136,7 @@ class MochaQaseReporter extends mocha_1.reporters.Base {
|
|
|
126
136
|
ctx.qaseId = this.qaseId;
|
|
127
137
|
ctx.title = this.title;
|
|
128
138
|
ctx.parameters = this.parameters;
|
|
139
|
+
ctx.groupParameters = this.groupParameters;
|
|
129
140
|
ctx.fields = this.fields;
|
|
130
141
|
ctx.suite = this.suite;
|
|
131
142
|
ctx.ignore = this.ignore;
|
|
@@ -136,7 +147,7 @@ class MochaQaseReporter extends mocha_1.reporters.Base {
|
|
|
136
147
|
onStartTest() {
|
|
137
148
|
this.currentType = 'test';
|
|
138
149
|
}
|
|
139
|
-
onEndTest(test) {
|
|
150
|
+
async onEndTest(test) {
|
|
140
151
|
if (this.metadata.ignore) {
|
|
141
152
|
return;
|
|
142
153
|
}
|
|
@@ -168,11 +179,12 @@ class MochaQaseReporter extends mocha_1.reporters.Base {
|
|
|
168
179
|
message: message ?? null,
|
|
169
180
|
muted: false,
|
|
170
181
|
params: this.metadata.parameters ?? {},
|
|
182
|
+
group_params: this.metadata.groupParameters ?? {},
|
|
171
183
|
relations: relations,
|
|
172
184
|
run_id: null,
|
|
173
185
|
signature: this.getSignature(test, ids),
|
|
174
186
|
steps: this.currentTest.steps,
|
|
175
|
-
id:
|
|
187
|
+
id: (0, uuid_1.v4)(),
|
|
176
188
|
execution: {
|
|
177
189
|
status: test.state
|
|
178
190
|
? MochaQaseReporter.statusMap[test.state]
|
|
@@ -186,7 +198,7 @@ class MochaQaseReporter extends mocha_1.reporters.Base {
|
|
|
186
198
|
testops_id: ids.length > 0 ? ids : null,
|
|
187
199
|
title: this.metadata.title && this.metadata.title != '' ? this.metadata.title : test.title,
|
|
188
200
|
};
|
|
189
|
-
|
|
201
|
+
await this.reporter.addTestResult(result);
|
|
190
202
|
this.metadata.clear();
|
|
191
203
|
this.currentTest = new currentTest();
|
|
192
204
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export interface Methods {
|
|
|
16
16
|
qaseId(id: number | number[]): void;
|
|
17
17
|
title(title: string): void;
|
|
18
18
|
parameters(values: Record<string, string>): void;
|
|
19
|
+
groupParameters(values: Record<string, string>): void;
|
|
19
20
|
fields(values: Record<string, string>): void;
|
|
20
21
|
suite(name: string): void;
|
|
21
22
|
ignore(): void;
|
|
@@ -33,6 +34,7 @@ export declare class Metadata {
|
|
|
33
34
|
title?: string;
|
|
34
35
|
fields?: Record<string, string>;
|
|
35
36
|
parameters?: Record<string, string>;
|
|
37
|
+
groupParameters?: Record<string, string>;
|
|
36
38
|
ignore?: boolean;
|
|
37
39
|
suite?: string;
|
|
38
40
|
comment?: string;
|
package/dist/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mocha-qase-reporter",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
4
|
"description": "Mocha Cypress Reporter",
|
|
5
5
|
"homepage": "https://github.com/qase-tms/qase-javascript",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"mocha": "^10.2.0",
|
|
44
44
|
"deasync-promise": "^1.0.1",
|
|
45
|
-
"qase-javascript-commons": "
|
|
45
|
+
"qase-javascript-commons": "~2.2.0",
|
|
46
46
|
"uuid": "^9.0.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|