@testomatio/reporter 1.0.3 β 1.0.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/README.md +10 -6
- package/lib/pipe/github.js +19 -21
- package/lib/pipe/testomatio.js +19 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Testomat.io Reporter (this npm package) supports:
|
|
|
12
12
|
* π Integarion with all popular [JavaScript/TypeScript frameworks](./docs/frameworks.md)
|
|
13
13
|
* ποΈ Screenshots, videos, traces [uploaded into S3 bucket](./docs/artifacts.md)
|
|
14
14
|
* π Stack traces and error messages
|
|
15
|
-
* π [GitHub](./docs/pipes.
|
|
15
|
+
* π [GitHub](./docs/pipes/github.d) & [GitLab](./docs/pipes/gitlab.d) integration
|
|
16
16
|
* π
Realtime reports
|
|
17
17
|
* ποΈ Other test frameworks supported via [JUNit XML](./docs/junit.md)
|
|
18
18
|
* πΆββοΈ Steps *(work in progress)*
|
|
@@ -85,13 +85,13 @@ or any [other via JUnit](./docs/junit.md) report....
|
|
|
85
85
|
|
|
86
86
|
### 2οΈβ£ Configure Reports
|
|
87
87
|
|
|
88
|
-
* [Create report on Testomat.io](./docs/pipes.md
|
|
89
|
-
* [Create brief summary report for GitHub Pull Request](./docs/pipes.md
|
|
90
|
-
* [Create brief summary report for GitLab Merge Request](./docs/pipes.md
|
|
91
|
-
* [Configure other pipes](./docs/pipes
|
|
88
|
+
* [Create report on Testomat.io](./docs/pipes/testomatio.md).
|
|
89
|
+
* [Create brief summary report for GitHub Pull Request](./docs/pipes/github.md) π
|
|
90
|
+
* [Create brief summary report for GitLab Merge Request](./docs/pipes/gitlab.md).
|
|
91
|
+
* [Configure other pipes](./docs/pipes/md) for other ways to process test results output.
|
|
92
92
|
|
|
93
93
|
|
|
94
|
-

|
|
94
|
+

|
|
95
95
|
|
|
96
96
|
GitHub report published as a comment to Pull Request:
|
|
97
97
|
|
|
@@ -121,6 +121,10 @@ Bring this reporter on CI and never lose test results again!
|
|
|
121
121
|
|
|
122
122
|
* π οΈ [Frameworks](./docs/frameworks.md)
|
|
123
123
|
* β² [Pipes](./docs/pipes.md)
|
|
124
|
+
* [Testomat.io](./docs/pipes/testomatio.md)
|
|
125
|
+
* [GitHub](./docs/pipes/github.md)
|
|
126
|
+
* [Gitlab](./docs/pipes/gitlab.md)
|
|
127
|
+
* [CSV](./docs/pipes/csv.md)
|
|
124
128
|
* π [JUnit](./docs/junit.md)
|
|
125
129
|
* ποΈ [Artifacts](./docs/artifacts.md)
|
|
126
130
|
* π [Workflows](./docs/workflows.md)
|
package/lib/pipe/github.js
CHANGED
|
@@ -21,7 +21,8 @@ class GitHubPipe {
|
|
|
21
21
|
this.token = params.GH_PAT || process.env.GH_PAT;
|
|
22
22
|
this.ref = process.env.GITHUB_REF;
|
|
23
23
|
this.repo = process.env.GITHUB_REPOSITORY;
|
|
24
|
-
this.
|
|
24
|
+
this.jobKey = `${process.env.GITHUB_WORKFLOW || ''} / ${process.env.GITHUB_JOB || ''}`;
|
|
25
|
+
this.hiddenCommentData = `<!--- testomat.io report ${this.jobKey} -->`;
|
|
25
26
|
|
|
26
27
|
debug('GitHub Pipe: ', this.token ? 'TOKEN' : '*no token*', 'Ref:', this.ref, 'Repo:', this.repo);
|
|
27
28
|
|
|
@@ -73,35 +74,32 @@ class GitHubPipe {
|
|
|
73
74
|
let summary = `${this.hiddenCommentData}
|
|
74
75
|
|
|
75
76
|
| [](https://testomat.io) | ${
|
|
76
|
-
statusEmoji(runParams.status,)} ${
|
|
77
|
+
statusEmoji(runParams.status,)} ${`${process.env.GITHUB_JOB} ${runParams.status}`.toUpperCase()} |
|
|
77
78
|
| --- | --- |
|
|
78
79
|
| Tests | βοΈ **${this.tests.length}** tests run |
|
|
79
|
-
| Summary | ${statusEmoji('failed')} **${failedCount}** failed; ${statusEmoji(
|
|
80
|
+
| Summary | ${failedCount ? `${statusEmoji('failed')} **${failedCount}** failed; ` : ''} ${statusEmoji(
|
|
80
81
|
'passed',
|
|
81
82
|
)} **${passedCount}** passed; **${statusEmoji('skipped')}** ${skippedCount} skipped |
|
|
82
|
-
| Duration | π **${humanizeDuration(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
| Duration | π **${humanizeDuration(
|
|
84
|
+
parseInt(
|
|
85
|
+
this.tests.reduce((a, t) => a + (t.run_time || 0), 0),
|
|
86
|
+
10,
|
|
87
|
+
),
|
|
88
|
+
{
|
|
89
|
+
maxDecimalPoints: 0,
|
|
90
|
+
},
|
|
91
|
+
)}** |`;
|
|
92
|
+
|
|
86
93
|
if (this.store.runUrl) {
|
|
87
|
-
summary +=
|
|
94
|
+
summary += `\n| Testomat.io Report | π [Run #${this.store.runId}](${this.store.runUrl}) | `;
|
|
88
95
|
}
|
|
89
96
|
if (process.env.GITHUB_WORKFLOW) {
|
|
90
|
-
summary +=
|
|
97
|
+
summary += `\n| Job | ποΈ [${this.jobKey}](${process.env.GITHUB_SERVER_URL || 'https://github.com'}/${
|
|
98
|
+
this.repo
|
|
99
|
+
}/actions/runs/${process.env.GITHUB_RUN_ID}) | `;
|
|
91
100
|
}
|
|
92
101
|
if (process.env.RUNNER_OS) {
|
|
93
|
-
summary +=
|
|
94
|
-
}
|
|
95
|
-
if (process.env.GITHUB_HEAD_REF) {
|
|
96
|
-
summary += `| Branch | π³ \`${process.env.GITHUB_HEAD_REF}\` | `;
|
|
97
|
-
}
|
|
98
|
-
if (process.env.GITHUB_RUN_ATTEMPT) {
|
|
99
|
-
summary += `| Run Attempt | π \`${process.env.GITHUB_RUN_ATTEMPT}\` | `;
|
|
100
|
-
}
|
|
101
|
-
if (process.env.GITHUB_RUN_ID) {
|
|
102
|
-
summary += `| Build Log | βοΈ ${process.env.GITHUB_SERVER_URL || 'https://github.com'}/${
|
|
103
|
-
this.repo
|
|
104
|
-
}/actions/runs/${process.env.GITHUB_RUN_ID} | `;
|
|
102
|
+
summary += `\n| Operating System | π₯οΈ \`${process.env.RUNNER_OS}\` ${process.env.RUNNER_ARCH || ''} | `;
|
|
105
103
|
}
|
|
106
104
|
|
|
107
105
|
const failures = this.tests
|
package/lib/pipe/testomatio.js
CHANGED
|
@@ -39,6 +39,7 @@ class TestomatioPipe {
|
|
|
39
39
|
this.proceed = process.env.TESTOMATIO_PROCEED;
|
|
40
40
|
this.runId = params.runId || process.env.runId;
|
|
41
41
|
this.createNewTests = !!process.env.TESTOMATIO_CREATE;
|
|
42
|
+
this.hasUnmatchedTests = false;
|
|
42
43
|
|
|
43
44
|
if (!isValidUrl(this.url.trim())) {
|
|
44
45
|
this.isEnabled = false;
|
|
@@ -115,14 +116,17 @@ class TestomatioPipe {
|
|
|
115
116
|
const responseData = err.response.data || { message: '' };
|
|
116
117
|
console.log(
|
|
117
118
|
APP_PREFIX,
|
|
118
|
-
chalk.
|
|
119
|
-
|
|
119
|
+
chalk.yellow(`Warning: ${responseData.message} (${err.response.status})`),
|
|
120
|
+
chalk.grey(data?.title || ''),
|
|
120
121
|
);
|
|
122
|
+
if (err.response.data.message.includes('could not be matched')) {
|
|
123
|
+
this.hasUnmatchedTests = true;
|
|
124
|
+
}
|
|
121
125
|
return;
|
|
122
126
|
}
|
|
123
|
-
console.log(APP_PREFIX, chalk.blue(
|
|
127
|
+
console.log(APP_PREFIX, chalk.blue(data?.title || ''), `Report couldn't be processed: ${err.response.data.message}`);
|
|
124
128
|
} else {
|
|
125
|
-
console.log(APP_PREFIX, chalk.blue(
|
|
129
|
+
console.log(APP_PREFIX, chalk.blue(data?.title || ''), "Report couldn't be processed", err);
|
|
126
130
|
}
|
|
127
131
|
});
|
|
128
132
|
}
|
|
@@ -159,6 +163,17 @@ class TestomatioPipe {
|
|
|
159
163
|
console.log(APP_PREFIX, `π ${notFinishedMessage}. Report URL: ${chalk.magenta(this.runUrl)}`);
|
|
160
164
|
console.log(APP_PREFIX, `π¬ Run to finish it: TESTOMATIO_RUN=${this.runId} npx start-test-run --finish`);
|
|
161
165
|
}
|
|
166
|
+
if (this.hasUnmatchedTests) {
|
|
167
|
+
console.log('');
|
|
168
|
+
console.log(APP_PREFIX, chalk.yellow.bold('β οΈ Some reported tests were not found in Testomat.io project'));
|
|
169
|
+
console.log(APP_PREFIX, `If you use Testomat.io as a reporter only, please re-run tests using ${chalk.bold('TESTOMATIO_CREATE=1')}`);
|
|
170
|
+
console.log(APP_PREFIX, `But to keep your tests consistent it is recommended to ${chalk.bold('import tests first')}`);
|
|
171
|
+
console.log(APP_PREFIX, 'If tests were imported but still not matched, assign test IDs to your tests.');
|
|
172
|
+
console.log(APP_PREFIX, 'You can do that automatically via command line tools:');
|
|
173
|
+
console.log(APP_PREFIX, chalk.bold('npx check-tests ... --update-ids'), 'See: https://bit.ly/js-update-ids');
|
|
174
|
+
console.log(APP_PREFIX, 'or for Cucumber:');
|
|
175
|
+
console.log(APP_PREFIX, chalk.bold('npx check-cucumber ... --update-ids'), 'See: https://bit.ly/bdd-update-ids');
|
|
176
|
+
}
|
|
162
177
|
} catch (err) {
|
|
163
178
|
console.log(APP_PREFIX, 'Error updating status, skipping...', err);
|
|
164
179
|
}
|