@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 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.md#github-pipe) & [GitLab](./docs/pipes.md#gitlab-pipe) integration
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#testomatio-pipe).
89
- * [Create brief summary report for GitHub Pull Request](./docs/pipes.md#github-pipe) πŸ‘‡
90
- * [Create brief summary report for GitLab Merge Request](./docs/pipes.md#gitlab-pipe).
91
- * [Configure other pipes](./docs/pipes.md) for other ways to process test results output.
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
- ![GitHub report](./docs/images/github.png)
94
+ ![GitHub report](./docs/pipes/images/github.png)
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)
@@ -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.hiddenCommentData = `<!--- testomat.io report ${process.env.GITHUB_WORKFLOW || ''} -->`;
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
  | [![Testomat.io Report](https://avatars.githubusercontent.com/u/59105116?s=36&v=4)](https://testomat.io) | ${
76
- statusEmoji(runParams.status,)} ${runParams.status.toUpperCase()} ${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(parseInt(this.tests.reduce((a, t) => a + (t.run_time || 0), 0), 10), {
83
- maxDecimalPoints: 0,
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 += `| Testomat.io Report | πŸ“Š [Run #${this.store.runId}](${this.store.runUrl}) | `;
94
+ summary += `\n| Testomat.io Report | πŸ“Š [Run #${this.store.runId}](${this.store.runUrl}) | `;
88
95
  }
89
96
  if (process.env.GITHUB_WORKFLOW) {
90
- summary += `| Workflow | πŸ—‚οΈ ${process.env.GITHUB_WORKFLOW} | `;
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 += `| Operating System | πŸ–₯️ \`${process.env.RUNNER_OS}\` ${process.env.RUNNER_ARCH || ''} | `;
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
@@ -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.blue(this.title),
119
- `Report couldn't be processed: (${err.response.status}) ${responseData.message}`,
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(this.title), `Report couldn't be processed: ${err.response.data.message}`);
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(this.title), "Report couldn't be processed", err);
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "typings": "typings/index.d.ts",