@testomatio/reporter 1.0.15-beta.2 β†’ 1.0.16

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
@@ -11,12 +11,12 @@ Testomat.io Reporter (this npm package) supports:
11
11
 
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
- * πŸ”Ž Stack traces and error messages
15
- * πŸ™ [GitHub](./docs/pipes/github.d) & [GitLab](./docs/pipes/gitlab.d) integration
14
+ * πŸ”Ž [Stack traces](./docs/stacktrace.md) and error messages
15
+ * πŸ™ [GitHub](./docs/pipes/github.md) & [GitLab](./docs/pipes/gitlab.md) integration
16
16
  * πŸš… Realtime reports
17
17
  * πŸ—ƒοΈ Other test frameworks supported via [JUNit XML](./docs/junit.md)
18
18
  * πŸšΆβ€β™€οΈ Steps *(work in progress)*
19
- * πŸ“„ Logger *(work in progress, supports Jest for now)*
19
+ * πŸ“„ [Logger](./docs/logger.md) *(work in progress, supports Jest for now)*
20
20
  * ☁️ Custom properties and metadata *(work in progress)*
21
21
  * πŸ’― Free & open-source.
22
22
  * πŸ“Š Public and private Run reports on cloud via [Testomat.io App](https://testomat.io) πŸ‘‡
@@ -128,7 +128,7 @@ Bring this reporter on CI and never lose test results again!
128
128
  * πŸ““ [JUnit](./docs/junit.md)
129
129
  * πŸ—„οΈ [Artifacts](./docs/artifacts.md)
130
130
  * πŸ”‚ [Workflows](./docs/workflows.md)
131
- * πŸ”‚ [Logger](./docs/logger.md)
131
+ * πŸ–ŠοΈ [Logger](./docs/logger.md)
132
132
 
133
133
  ## Development
134
134
 
@@ -42,12 +42,21 @@ class JestReporter {
42
42
  steps = failureMessages[0];
43
43
  }
44
44
  const testId = parseTest(title);
45
+ let suite_title;
46
+ // this is test without a suite
47
+ if (result.fullName === result.title) {
48
+ suite_title = testResult.testFilePath.split('/').pop();
49
+ } else {
50
+ suite_title = result.fullName.replace(result.title, '');
51
+ }
52
+
45
53
  const deducedStatus = status === 'pending' ? 'skipped' : status;
46
54
  // In jest if test is not matched with test name pattern it is considered as skipped.
47
55
  // So adding a check if it is skipped for real or because of test pattern
48
56
  if (!this._globalConfig.testNamePattern || deducedStatus !== 'skipped') {
49
57
  this.client.addTestRun(deducedStatus, {
50
58
  test_id: testId,
59
+ suite_title,
51
60
  error,
52
61
  steps,
53
62
  title,
@@ -19,10 +19,6 @@ function MochaReporter(runner, opts) {
19
19
 
20
20
  const apiKey = opts?.reporterOptions?.apiKey || process.env.TESTOMATIO;
21
21
 
22
- if (!apiKey) {
23
- debug('TESTOMATIO key is empty, ignoring reports');
24
- return;
25
- }
26
22
  const client = new TestomatClient({ apiKey });
27
23
 
28
24
  runner.on(EVENT_RUN_BEGIN, () => {
package/lib/client.js CHANGED
@@ -1,6 +1,7 @@
1
1
  const debug = require('debug')('@testomatio/reporter:client');
2
2
  const createCallsiteRecord = require('callsite-record');
3
3
  const { sep, join } = require('path');
4
+ const { minimatch } = require('minimatch')
4
5
  const fs = require('fs');
5
6
  const chalk = require('chalk');
6
7
  const { randomUUID } = require('crypto');
@@ -270,17 +271,21 @@ class Client {
270
271
  stack += '\n\n';
271
272
  }
272
273
 
274
+ const customFilter = process.env.TESTOMATIO_STACK_FILTER;
275
+
273
276
  try {
277
+ let hasFrame = false;
274
278
  const record = createCallsiteRecord({
275
279
  forError: error,
280
+ isCallsiteFrame: frame => {
281
+ if (customFilter && minimatch(frame.getFileName(), customFilter)) return false;
282
+ if (hasFrame) return false;
283
+ if (isNotInternalFrame(frame)) hasFrame = true;
284
+ return hasFrame;
285
+ }
276
286
  });
277
287
  if (record && !record.filename.startsWith('http')) {
278
- stack += record.renderSync({
279
- stackFilter: frame =>
280
- frame.getFileName().indexOf(sep) > -1 &&
281
- frame.getFileName().indexOf('node_modules') < 0 &&
282
- frame.getFileName().indexOf('internal') < 0,
283
- });
288
+ stack += record.renderSync({ stackFilter: isNotInternalFrame });
284
289
  }
285
290
  return stack;
286
291
  } catch (e) {
@@ -289,4 +294,10 @@ class Client {
289
294
  }
290
295
  }
291
296
 
297
+ function isNotInternalFrame(frame) {
298
+ return frame.getFileName().includes(sep) &&
299
+ !frame.getFileName().includes('node_modules') &&
300
+ !frame.getFileName().includes('internal')
301
+ }
302
+
292
303
  module.exports = Client;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "1.0.15-beta.2",
3
+ "version": "1.0.16",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "typings": "typings/index.d.ts",
@@ -20,13 +20,14 @@
20
20
  "debug": "^4.3.4",
21
21
  "dotenv": "^16.0.1",
22
22
  "fast-xml-parser": "^4.0.8",
23
- "glob": "^8.0.3",
23
+ "glob": "^10.3",
24
24
  "has-flag": "^5.0.1",
25
25
  "humanize-duration": "^3.27.3",
26
26
  "is-valid-path": "^0.1.1",
27
27
  "json-cycle": "^1.3.0",
28
28
  "lodash.memoize": "^4.1.2",
29
29
  "lodash.merge": "^4.6.2",
30
+ "minimatch": "^9.0.3",
30
31
  "uuid": "^9.0.0"
31
32
  },
32
33
  "files": [
package/Changelog.md DELETED
@@ -1,340 +0,0 @@
1
- <!-- pending release updates -->
2
- # 1.0.15
3
-
4
- * Attach Run to Jira Issue via `TESTOMATIO_JIRA_ID` env variable:
5
-
6
- ```
7
- TESTOMATIO_JIRA_ID=TST-12 <actual run command>
8
- ```
9
-
10
- # 1.0.14
11
-
12
- * Execute tests by tag names. Use this filter to select tests associated with specific tags.
13
-
14
- ```bash
15
- TESTOMATIO={API_KEY} npx start-test-run -c 'actual run command' --filter 'testomatio:tag-name=smoke'
16
- ```
17
-
18
- * more instruction you can find in docs/pipes/testomatio.md
19
-
20
- # 1.0.13
21
-
22
- * JUnit improvements
23
- * Match test from source code by adding Test ID as a comment:
24
-
25
- ```java
26
- // @T8acca9eb
27
- ```
28
- * Match test from output by adding Test ID as output:
29
-
30
- ```java
31
- System.out.println("tid://@T8acca9eb");
32
- ```
33
- * Support for suite before and after output
34
- * Improved support for artifacts
35
-
36
- # 1.0.12
37
-
38
- & Logger refactoring by @olexandr13 in #208
39
- * fix undefined logs by @olexandr13 in #210
40
-
41
- # 1.0.11
42
-
43
- * fix steps duplication for codecept report by @olexandr13 in #209
44
-
45
- # 1.0.10
46
-
47
- * Added `TESTOMATIO_PUBLISH=1` variable to automatically publish run report
48
-
49
- # 1.0.9
50
-
51
- * Support XUnit format
52
- * Improved support for parametrized Java tests
53
-
54
- # 1.0.8
55
-
56
- * Fixed `Can't read push of undefined` when logging steps
57
-
58
- # 1.0.6
59
-
60
- * Testomat.io. Auto-detect current build url and report it to Testomat.io. Manually url can be set with `BUILD_URL` variable:
61
-
62
- ```
63
- BUILD_URL=https://.... TESTOMATIO=apiKey <actual test command>
64
- ```
65
-
66
- # 1.0.5
67
-
68
- * Fix "create tests" params processing for testomatio pipe
69
-
70
- # 1.0.4
71
-
72
- * Fixed parallel run
73
-
74
- # 1.0.3
75
-
76
- * Fixed reporting parallel runs
77
-
78
- # 1.0.0
79
-
80
-
81
- * Added [`TESTOMATIO_SHARED_RUN` option](https://github.com/testomatio/reporter/blob/master/docs/pipes.md#reporting-parallel-execution-to-to-same-run) to use a shared run for parallel executions
82
- * Reworked [documentation](https://github.com/testomatio/reporter/tree/master#readme).
83
- * Added an option to obtain [S3 configuration](https://github.com/testomatio/reporter/blob/master/docs/artifacts.md#configuration) from Testomat.io
84
- * Introduced [pipes](https://github.com/testomatio/reporter/blob/master/docs/pipes.md):
85
- * GitHub
86
- * GitLab
87
- * CSV Pipe
88
-
89
-
90
- # 0.7.6
91
-
92
- * Updated to use AWS S3 3.0 SDK for uploading
93
-
94
- # 0.7.5
95
-
96
- * Fixed reporting skipped tests in mocha
97
-
98
- # 0.7.4
99
-
100
- * Fixed parsing source code in JUnit files
101
-
102
- # 0.7.3
103
-
104
- * CodeceptJS: Upload all traces and videos from artifacts
105
- * Fixed reporting skipped test in XML
106
- * added `--timelimit` option to `report-xml` command line
107
-
108
- # 0.7.2
109
-
110
- * Fixed uploading non-existing file
111
-
112
- # 0.7.1
113
-
114
- * Support for NUnit XML v3 format
115
-
116
- # 0.7.0
117
-
118
- * Support for `@cucumber/cucumber` (>= 7.0) added
119
- * Initial support for C# and NUnit
120
-
121
- # 0.6.10
122
-
123
- * Fixed uploading multilpe artifacts in Playwright
124
-
125
- # 0.6.9
126
-
127
- * Fixed pending tests reports for Cypress
128
-
129
- # 0.6.8
130
- # 0.6.7
131
-
132
- * Pytest: fixed creating suites from reports
133
-
134
- # 0.6.6
135
-
136
- * JUnit reporter: prefer suite title over testcase classname in a report
137
-
138
- # 0.6.5
139
-
140
- * Fixed test statuses for runs in JUnit reporter
141
-
142
- # 0.6.4
143
-
144
- * Added `TESTOMATIO_PROCEED=1` param to not close current run
145
- * Fixed priority of commands from `npx @testomatio/reporter`
146
-
147
- # 0.6.3
148
-
149
- * Fixed `npx start-test-run` to launch commands
150
-
151
- # 0.6.2
152
-
153
- * Added `--env-file` option to load env variables from env file
154
-
155
- # 0.6.1
156
-
157
- * Fixed creating RunGroup with JUnit reporter
158
-
159
- # 0.6.0
160
-
161
- * JUnit reporter support
162
-
163
- # 0.5.10
164
-
165
- * Fixed reporting Scenario Outline in Cypress-Cucumber
166
- * Fixed error reports for Cypress when running in Chrome
167
-
168
- # 0.5.9
169
-
170
- * Added environment on Cypress report
171
-
172
- # 0.5.8
173
-
174
- * Fixed Cypress.io reporting
175
-
176
- # 0.5.7
177
-
178
- * Fixed webdriverio artifacts
179
-
180
- # 0.5.6
181
-
182
- * Unmark failed CodeceptJS tests as skipped
183
-
184
- # 0.5.5
185
-
186
- * Fixed `BeforeSuite` failures in CodeceptJS
187
-
188
- # 0.5.4
189
-
190
- Added `TESTOMATIO_CREATE=1` option to create unmatched tests on report
191
-
192
- ```
193
- TESTOMATIO_CREATE=1 TESTOMATIO=apiKey npx codeceptjs run
194
- ```
195
-
196
- # 0.5.3
197
-
198
- * Fixed parsing suites
199
-
200
- # 0.5.2
201
-
202
- * Fixed multiple upload of artifacts in Cypress.io
203
-
204
- # 0.5.1
205
-
206
- * Fixed Cypress.io to report tests inside nested suites
207
-
208
- # 0.5.0
209
-
210
- * Added Cypress.io plugin
211
- * Added artifacts upload to webdriverio
212
-
213
- # 0.4.6
214
-
215
- - Fixed CodeceptJS reporter to report tests failed in hooks
216
-
217
- # 0.4.5
218
-
219
- - Fixed "Total XX artifacts publicly uploaded to S3 bucket" when no S3 bucket is configured
220
- - Improved S3 connection error messages
221
-
222
- # 0.4.4
223
-
224
- - Fixed returning 0 exit code when a process fails when running tests in parallel via `start-test-run`. Previously was using the last exit code returned by a process. Currently prefers the highest exit code that was returned by a process.
225
-
226
- # 0.4.3
227
-
228
- - Added `TESTOMATIO_DISABLE_ARTIFACTS` env variable to disable publishing artifacts.
229
-
230
- # 0.4.2
231
-
232
- - print version of reporter
233
- - print number of uploaded artifacts
234
- - print access mode for uploaded artifacts
235
-
236
- # 0.4.1
237
-
238
- Added `global.testomatioArtifacts = []` array which can be used to add arbitrary artifacts to a report.
239
-
240
- ```js
241
- // inside a running test:
242
- global.testomatioArtifacts.push('file/to/upload.png');
243
- ```
244
-
245
- # 0.4.0
246
-
247
- - Playwright: Introduced playwright/test support with screenshots and video artifacts
248
-
249
- > Known issues: reporting using projects configured in Playwright does not work yet
250
-
251
- - CodeceptJS: added video uploads
252
-
253
- # 0.3.16
254
-
255
- - CodeceptJS: fixed reporting tests with empty steps (on retry)
256
-
257
- # 0.3.15
258
-
259
- - Finish Run via API:
260
-
261
- ```
262
- TESTOMATIO={apiKey} TESTOMATIO_RUN={runId} npx @testomatio/reporter@latest --finish
263
- ```
264
-
265
- # 0.3.14
266
-
267
- - Create an empty Run via API:
268
-
269
- ```
270
- TESTOMATIO={apiKey} npx @testomatio/reporter@latest --launch
271
- ```
272
-
273
- # 0.3.13
274
-
275
- - Checking for a valid report URL
276
- - Sending unlimited data on test report
277
-
278
- # 0.3.12
279
-
280
- - Fixed submitting arbitrary data on a test run
281
- - Jest: fixed sending errors with stack traces
282
- - Cypress: fixed sending reports
283
-
284
- # 0.3.11
285
-
286
- - Fixed circular JSON reference when submitting data to Testomatio
287
-
288
- # 0.3.10
289
-
290
- - Minor fixes
291
-
292
- # 0.3.9
293
-
294
- - Making all reporters to run without API key
295
-
296
- # 0.3.8
297
-
298
- - Fixed `npx start-test-run` to work with empty API keys
299
-
300
- # 0.3.7
301
-
302
- - Fixed release
303
-
304
- # 0.3.6
305
-
306
- - Update title and rungroup on start for scheduled runs.
307
-
308
- # 0.3.5
309
-
310
- - Added `TESTOMATIO_RUN` environment variable to pass id of a specific run to report
311
-
312
- # 0.3.4
313
-
314
- - Minor fixes
315
-
316
- # 0.3.3
317
-
318
- - [CodeceptJS] Fixed stack trace reporting
319
- - [CodeceptJS] Fixed displaying of nested steps
320
- - [CodeceptJS][mocha] Added assertion diff to report
321
-
322
- # 0.3.2
323
-
324
- - Fixed error message for S3 uploading
325
-
326
- # 0.3.1
327
-
328
- - [CodeceptJS] Better formatter for nested structures and BDD tests
329
-
330
- # 0.3.0
331
-
332
- - Added `TESTOMATIO_TITLE` env variable to set a name for Run
333
- - Added `TESTOMATIO_RUNGROUP_TITLE` env variable to attach Run to RunGroup
334
- - Added `TESTOMATIO_ENV` env variable to attach additional env values to report
335
- - [CodeceptJS] **CodeceptJS v3 support**
336
- - [CodeceptJS] Dropped support for CodeceptJS 2
337
- - [CodeceptJS] Added support for before hooks
338
- - [CodeceptJS] Log of steps
339
- - [CodeceptJS] Upload screenshots of failed tests to S3
340
- - [CodeceptJS] Updated to use with parallel execution