@zohodesk/testinglibrary 0.3.0-experimental → 0.3.2-experimental
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 +10 -1
- package/build/core/playwright/setup/custom-reporter.js +39 -13
- package/jest.config.js +1 -1
- package/npm-shrinkwrap.json +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -15,4 +15,13 @@
|
|
|
15
15
|
### Generate Report
|
|
16
16
|
|
|
17
17
|
- npm run report
|
|
18
|
-
|
|
18
|
+
|
|
19
|
+
## Version History
|
|
20
|
+
|
|
21
|
+
### v0.2.8 - 26-09-2024
|
|
22
|
+
|
|
23
|
+
#### Feature
|
|
24
|
+
- Added support for writing unitcases for framework implementations
|
|
25
|
+
|
|
26
|
+
### Bug fix
|
|
27
|
+
- Updated the custom-reported to include the errors in tests during the executions. It will help us avoid the stage passed without the actual test execution.
|
|
@@ -18,6 +18,7 @@ class JSONSummaryReporter {
|
|
|
18
18
|
this.skipped = [];
|
|
19
19
|
this.failed = [];
|
|
20
20
|
this.warned = [];
|
|
21
|
+
this.errored = [];
|
|
21
22
|
this.interrupted = [];
|
|
22
23
|
this.timedOut = [];
|
|
23
24
|
this.flakey = [];
|
|
@@ -29,7 +30,7 @@ class JSONSummaryReporter {
|
|
|
29
30
|
onBegin() {
|
|
30
31
|
this.startedAt = Date.now();
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
+
getTitle(test) {
|
|
33
34
|
const title = [];
|
|
34
35
|
const fileName = [];
|
|
35
36
|
let clean = true;
|
|
@@ -39,35 +40,52 @@ class JSONSummaryReporter {
|
|
|
39
40
|
}
|
|
40
41
|
clean = false;
|
|
41
42
|
title.push(s);
|
|
42
|
-
if (s.
|
|
43
|
+
if (s.endsWith('.ts') || s.endsWith('.js')) {
|
|
43
44
|
fileName.push(s);
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
|
|
48
|
+
//Using the fullTitle variable in the push will push a full test name + test description
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
fullTitle: title.join(' > '),
|
|
52
|
+
fileName: fileName[0] || ''
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
onTestEnd(test, result) {
|
|
56
|
+
const {
|
|
57
|
+
fullTitle,
|
|
58
|
+
fileName
|
|
59
|
+
} = this.getTitle(test);
|
|
60
|
+
|
|
50
61
|
// Set the status
|
|
51
|
-
const stepTitleList = result.steps.map(step => ({
|
|
62
|
+
const stepTitleList = result.steps.filter(step => step.error).map(step => ({
|
|
52
63
|
title: step.title,
|
|
53
64
|
error: step.error,
|
|
54
|
-
testTitle:
|
|
55
|
-
}))
|
|
65
|
+
testTitle: fullTitle
|
|
66
|
+
}));
|
|
56
67
|
if (stepTitleList.length > 0) {
|
|
57
68
|
this.failedSteps = [...this.failedSteps, ...stepTitleList];
|
|
58
69
|
}
|
|
59
|
-
const status = !['passed', 'skipped'].includes(result.status) &&
|
|
70
|
+
const status = !['passed', 'skipped'].includes(result.status) && fullTitle.includes('@warn') ? 'warned' : result.status;
|
|
60
71
|
// Logic to push the results into the correct array
|
|
61
72
|
if (result.status === 'passed' && result.retry >= 1) {
|
|
62
|
-
this.flakey.push(
|
|
73
|
+
this.flakey.push(fileName);
|
|
63
74
|
} else {
|
|
64
|
-
this[status].push(
|
|
75
|
+
this[status].push(fileName);
|
|
65
76
|
}
|
|
66
|
-
this[status].push(
|
|
77
|
+
this[status].push(fileName);
|
|
78
|
+
}
|
|
79
|
+
onError(error) {
|
|
80
|
+
this.errored.push({
|
|
81
|
+
error: error.message,
|
|
82
|
+
stack: error.stack
|
|
83
|
+
});
|
|
67
84
|
}
|
|
68
85
|
onEnd(result) {
|
|
69
86
|
this.durationInMS = Date.now() - this.startedAt;
|
|
70
87
|
this.status = result.status;
|
|
88
|
+
|
|
71
89
|
// removing duplicate tests from passed array
|
|
72
90
|
this.passed = this.passed.filter((element, index) => {
|
|
73
91
|
return this.passed.indexOf(element) === index;
|
|
@@ -90,6 +108,14 @@ class JSONSummaryReporter {
|
|
|
90
108
|
this.interrupted = this.interrupted.filter((element, index) => {
|
|
91
109
|
return this.interrupted.indexOf(element) === index;
|
|
92
110
|
});
|
|
111
|
+
this.errored = this.errored.filter((element, index) => {
|
|
112
|
+
return this.errored.indexOf(element) === index;
|
|
113
|
+
});
|
|
114
|
+
if (this.errored.length > 0) {
|
|
115
|
+
// Reflect setup failures in the final report status
|
|
116
|
+
this.status = "failed";
|
|
117
|
+
}
|
|
118
|
+
|
|
93
119
|
// fs.writeFileSync('./summary.json', JSON.stringify(this, null, ' '));
|
|
94
120
|
let {
|
|
95
121
|
reportPath
|
package/jest.config.js
CHANGED
package/npm-shrinkwrap.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/testinglibrary",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2-experimental",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
"jest-environment-jsdom": "29.6.2",
|
|
35
35
|
"msw": "1.2.3",
|
|
36
36
|
"playwright": "1.42.1",
|
|
37
|
-
"react": "^18.3.1",
|
|
38
37
|
"supports-color": "8.1.1"
|
|
39
38
|
},
|
|
40
39
|
"bin": {
|