@testomatio/reporter 0.4.5 → 0.4.6

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,3 +1,7 @@
1
+ # 0.4.6
2
+
3
+ * Fixed CodeceptJS reporter to report tests failed in hooks
4
+
1
5
  # 0.4.5
2
6
 
3
7
  * Fixed "Total XX artifacts publicly uploaded to S3 bucket" when no S3 bucket is configured
@@ -11,6 +11,7 @@ const upload = require("../fileUploader");
11
11
  const Output = require("../output");
12
12
 
13
13
  let currentMetaStep = [];
14
+ let error;
14
15
  let stepShift = 0;
15
16
  const output = new Output({
16
17
  filterFn: (stack) => !stack.includes("codeceptjs/lib/output"), // output from codeceptjs
@@ -85,6 +86,7 @@ module.exports = (config) => {
85
86
 
86
87
  event.dispatcher.on(event.test.started, (test) => {
87
88
  testTimeMap[test.id] = Date.now();
89
+ err = null;
88
90
  });
89
91
 
90
92
  event.dispatcher.on(event.all.result, async () => {
@@ -123,14 +125,19 @@ module.exports = (config) => {
123
125
  output.stop();
124
126
  });
125
127
 
128
+ event.dispatcher.on(event.test.failed, (test, err) => {
129
+ error = err;
130
+ });
131
+
126
132
  event.dispatcher.on(event.test.after, (test) => {
127
133
  if (test.state && test.state !== FAILED) return;
128
- const { id, tags, title, err, artifacts } = test;
134
+ if (test.err) error = test.err;
135
+ const { id, tags, title, artifacts } = test;
129
136
  failedTests.push(id || title);
130
137
  const testId = parseTest(tags);
131
138
  const testObj = getTestAndMessage(title);
132
- if (err && err.stack && test.steps && test.steps.length) {
133
- err.stack = test.steps[test.steps.length - 1].line();
139
+ if (error && error.stack && test.steps && test.steps.length) {
140
+ error.stack = test.steps[test.steps.length - 1].line();
134
141
  }
135
142
 
136
143
  const files = [];
@@ -140,7 +147,7 @@ module.exports = (config) => {
140
147
 
141
148
  client.addTestRun(testId, TRConstants.FAILED, {
142
149
  ...stripExampleFromTitle(title),
143
- error: err,
150
+ error,
144
151
  message: testObj.message,
145
152
  time: getDuration(test),
146
153
  files,
package/lib/client.js CHANGED
@@ -125,6 +125,7 @@ class TestomatClient {
125
125
 
126
126
  if (error) {
127
127
  stack = this.formatError(error);
128
+ message = error.message;
128
129
  }
129
130
  if (steps) {
130
131
  stack = this.formatSteps(stack, steps);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "repository": "git@github.com:testomatio/reporter.git",