@opra/testing 0.31.10 → 0.31.12

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.
@@ -29,9 +29,15 @@ class ApiExpect extends api_expect_base_js_1.ApiExpectBase {
29
29
  catch (e) {
30
30
  e.message = 'Request didn\'t succeeded as expected. ' + msg + '\n\n' + e.message;
31
31
  const issues = this.response.body?.errors;
32
- const issue = issues?.[0]?.message;
33
- if (issue) {
34
- e.message += '\n\n' + ansi_colors_1.default.yellow('Server message: ') + issue;
32
+ if (issues) {
33
+ e.message += '\n\n';
34
+ issues.forEach((issue, i) => {
35
+ const stack = Array.isArray(issue.stack)
36
+ ? issue.stack.join('\n') : issue.stack;
37
+ e.message += ansi_colors_1.default.yellow(issues.length > 1 ? `Error [${i}]: ` : 'Error: ') +
38
+ issue.message + '\n' +
39
+ (stack ? ' ' + stack.substring(stack.indexOf('at ')) + '\n' : '');
40
+ });
35
41
  }
36
42
  Error.captureStackTrace(e, this.toSuccess);
37
43
  throw e;
@@ -57,9 +63,15 @@ class ApiExpect extends api_expect_base_js_1.ApiExpectBase {
57
63
  catch (e) {
58
64
  e.message = 'Request didn\'t failed as expected. ' + msg + '\n\n' + e.message;
59
65
  const issues = this.response.body?.errors;
60
- const issue = issues?.[0]?.message;
61
- if (issue) {
62
- e.message += '\n\n' + ansi_colors_1.default.yellow('Server message: ') + issue;
66
+ if (issues) {
67
+ e.message += '\n\n';
68
+ issues.forEach((issue, i) => {
69
+ const stack = Array.isArray(issue.stack)
70
+ ? issue.stack.join('\n') : issue.stack;
71
+ e.message += ansi_colors_1.default.yellow(issues.length > 1 ? `Error [${i}]: ` : 'Error: ') +
72
+ issue.message + '\n' +
73
+ (stack ? ' ' + stack.substring(stack.indexOf('at ')) + '\n' : '');
74
+ });
63
75
  }
64
76
  Error.captureStackTrace(e, this.toSuccess);
65
77
  throw e;
@@ -25,9 +25,15 @@ export class ApiExpect extends ApiExpectBase {
25
25
  catch (e) {
26
26
  e.message = 'Request didn\'t succeeded as expected. ' + msg + '\n\n' + e.message;
27
27
  const issues = this.response.body?.errors;
28
- const issue = issues?.[0]?.message;
29
- if (issue) {
30
- e.message += '\n\n' + colors.yellow('Server message: ') + issue;
28
+ if (issues) {
29
+ e.message += '\n\n';
30
+ issues.forEach((issue, i) => {
31
+ const stack = Array.isArray(issue.stack)
32
+ ? issue.stack.join('\n') : issue.stack;
33
+ e.message += colors.yellow(issues.length > 1 ? `Error [${i}]: ` : 'Error: ') +
34
+ issue.message + '\n' +
35
+ (stack ? ' ' + stack.substring(stack.indexOf('at ')) + '\n' : '');
36
+ });
31
37
  }
32
38
  Error.captureStackTrace(e, this.toSuccess);
33
39
  throw e;
@@ -53,9 +59,15 @@ export class ApiExpect extends ApiExpectBase {
53
59
  catch (e) {
54
60
  e.message = 'Request didn\'t failed as expected. ' + msg + '\n\n' + e.message;
55
61
  const issues = this.response.body?.errors;
56
- const issue = issues?.[0]?.message;
57
- if (issue) {
58
- e.message += '\n\n' + colors.yellow('Server message: ') + issue;
62
+ if (issues) {
63
+ e.message += '\n\n';
64
+ issues.forEach((issue, i) => {
65
+ const stack = Array.isArray(issue.stack)
66
+ ? issue.stack.join('\n') : issue.stack;
67
+ e.message += colors.yellow(issues.length > 1 ? `Error [${i}]: ` : 'Error: ') +
68
+ issue.message + '\n' +
69
+ (stack ? ' ' + stack.substring(stack.indexOf('at ')) + '\n' : '');
70
+ });
59
71
  }
60
72
  Error.captureStackTrace(e, this.toSuccess);
61
73
  throw e;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/testing",
3
- "version": "0.31.10",
3
+ "version": "0.31.12",
4
4
  "description": "Opra testing package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -22,12 +22,12 @@
22
22
  "clean": "npm run clean:src && npm run clean:test && npm run clean:dist && npm run clean:cover",
23
23
  "clean:src": "ts-cleanup -s src --all",
24
24
  "clean:test": "ts-cleanup -s test --all",
25
- "clean:dist": "rimraf ../../build/client",
26
- "clean:cover": "rimraf ../../coverage/client"
25
+ "clean:dist": "rimraf ../../build/testing",
26
+ "clean:cover": "rimraf ../../coverage/testing"
27
27
  },
28
28
  "dependencies": {
29
- "@opra/client": "^0.31.10",
30
- "@opra/common": "^0.31.10",
29
+ "@opra/client": "^0.31.12",
30
+ "@opra/common": "^0.31.12",
31
31
  "ansi-colors": "^4.1.3",
32
32
  "lodash.isnil": "^4.0.0",
33
33
  "lodash.omitby": "^4.6.0",