@testomatio/reporter 1.0.15 β†’ 1.0.17

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 CHANGED
@@ -1,4 +1,17 @@
1
1
  <!-- pending release updates -->
2
+ # 1.0.17
3
+
4
+ Renamed `TESTOMATIO_STACK_FILTER` to `TESTOMATIO_STACK_IGNORE`
5
+
6
+ # 1.0.16
7
+
8
+ * Addded [stack trace configuration](./docs/stacktrace.md) and documentation:
9
+
10
+ ```
11
+ TESTOMATIO_STACK_IGNORE="tests/support/**.js" <actual-run-command>
12
+ ```
13
+ * Jest: fixed reporting tests without a suite title
14
+
2
15
  # 1.0.15
3
16
 
4
17
  * Attach Run to Jira Issue via `TESTOMATIO_JIRA_ID` env variable:
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,
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_IGNORE;
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",
3
+ "version": "1.0.17",
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": [