@opra/testing 1.23.0 → 1.23.2

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.
@@ -1,5 +1,5 @@
1
1
  import typeIs from '@browsery/type-is';
2
- import { omitNullish } from '@jsopen/objects';
2
+ import { omitNullish, updateErrorMessage } from '@jsopen/objects';
3
3
  import { MimeTypes, OpraFilter } from '@opra/common';
4
4
  import { expect } from 'expect';
5
5
  import ruleJudgmentLib from 'rule-judgment';
@@ -35,7 +35,10 @@ export class ApiExpectCollection extends ApiExpectBase {
35
35
  catch (e) {
36
36
  if (msg)
37
37
  e.message = msg + '\n\n' + e.message;
38
- Error.captureStackTrace(e, this.toReturnItems);
38
+ if (typeof Error.captureStackTrace === 'function')
39
+ Error.captureStackTrace(e, this.toReturnItems);
40
+ else
41
+ updateErrorMessage(e, e.message);
39
42
  throw e;
40
43
  }
41
44
  return this;
@@ -52,7 +55,10 @@ export class ApiExpectCollection extends ApiExpectBase {
52
55
  catch (e) {
53
56
  if (msg)
54
57
  e.message = msg + '\n\n' + e.message;
55
- Error.captureStackTrace(e, this.toReturnItems);
58
+ if (typeof Error.captureStackTrace === 'function')
59
+ Error.captureStackTrace(e, this.toReturnItems);
60
+ else
61
+ updateErrorMessage(e, e.message);
56
62
  throw e;
57
63
  }
58
64
  return this;
@@ -1,4 +1,5 @@
1
1
  import '../expect-extend/index.js';
2
+ import { updateErrorMessage } from '@jsopen/objects';
2
3
  import { ApiExpectBase } from './api-expect-base.js';
3
4
  export class ApiExpectOperationResult extends ApiExpectBase {
4
5
  get not() {
@@ -16,7 +17,10 @@ export class ApiExpectOperationResult extends ApiExpectBase {
16
17
  catch (e) {
17
18
  if (msg)
18
19
  e.message = msg + '\n\n' + e.message;
19
- Error.captureStackTrace(e, this.toBeAffected);
20
+ if (typeof Error.captureStackTrace === 'function')
21
+ Error.captureStackTrace(e, this.toBeAffected);
22
+ else
23
+ updateErrorMessage(e, e.message);
20
24
  throw e;
21
25
  }
22
26
  return this;
@@ -1,4 +1,5 @@
1
1
  import '../expect-extend/index.js';
2
+ import { updateErrorMessage } from '@jsopen/objects';
2
3
  import { MimeTypes } from '@opra/common';
3
4
  import colors from 'ansi-colors';
4
5
  import { expect } from 'expect';
@@ -43,7 +44,10 @@ export class ApiExpect extends ApiExpectBase {
43
44
  : '');
44
45
  });
45
46
  }
46
- Error.captureStackTrace(e, this.toSuccess);
47
+ if (typeof Error.captureStackTrace === 'function')
48
+ Error.captureStackTrace(e, this.toSuccess);
49
+ else
50
+ updateErrorMessage(e, e.message);
47
51
  throw e;
48
52
  }
49
53
  return this;
@@ -83,7 +87,10 @@ export class ApiExpect extends ApiExpectBase {
83
87
  : '');
84
88
  });
85
89
  }
86
- Error.captureStackTrace(e, this.toSuccess);
90
+ if (typeof Error.captureStackTrace === 'function')
91
+ Error.captureStackTrace(e, this.toFail);
92
+ else
93
+ updateErrorMessage(e, e.message);
87
94
  throw e;
88
95
  }
89
96
  return new ApiExpectError(this.response);
@@ -107,7 +114,10 @@ export class ApiExpect extends ApiExpectBase {
107
114
  "Api didn't returned a Collection. " + msg + '\n\n' + e.message;
108
115
  if (msg)
109
116
  e.message = msg + '\n\n' + e.message;
110
- Error.captureStackTrace(e, this.toReturnCollection);
117
+ if (typeof Error.captureStackTrace === 'function')
118
+ Error.captureStackTrace(e, this.toReturnCollection);
119
+ else
120
+ updateErrorMessage(e, e.message);
111
121
  throw e;
112
122
  }
113
123
  return new ApiExpectCollection(this.response);
@@ -130,7 +140,10 @@ export class ApiExpect extends ApiExpectBase {
130
140
  e.message = "Api didn't returned an Object. " + msg + '\n\n' + e.message;
131
141
  if (msg)
132
142
  e.message = msg + '\n\n' + e.message;
133
- Error.captureStackTrace(e, this.toReturnCollection);
143
+ if (typeof Error.captureStackTrace === 'function')
144
+ Error.captureStackTrace(e, this.toReturnObject);
145
+ else
146
+ updateErrorMessage(e, e.message);
134
147
  throw e;
135
148
  }
136
149
  return new ApiExpectObject(this.response);
@@ -154,7 +167,10 @@ export class ApiExpect extends ApiExpectBase {
154
167
  "Api didn't returned a OperationResult. " + msg + '\n\n' + e.message;
155
168
  if (msg)
156
169
  e.message = msg + '\n\n' + e.message;
157
- Error.captureStackTrace(e, this.toReturnCollection);
170
+ if (typeof Error.captureStackTrace === 'function')
171
+ Error.captureStackTrace(e, this.toReturnOperationResult);
172
+ else
173
+ updateErrorMessage(e, e.message);
158
174
  throw e;
159
175
  }
160
176
  return new ApiExpectOperationResult(this.response);
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@opra/testing",
3
- "version": "1.23.0",
3
+ "version": "1.23.2",
4
4
  "description": "Opra testing package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
7
7
  "dependencies": {
8
8
  "@browsery/type-is": "^2.0.1",
9
- "@jsopen/objects": "^2.0.2",
9
+ "@jsopen/objects": "^2.1.1",
10
10
  "ansi-colors": "^4.1.3",
11
11
  "rule-judgment": "^1.1.5",
12
12
  "tslib": "^2.8.1"
13
13
  },
14
14
  "peerDependencies": {
15
- "@opra/client": "^1.23.0",
16
- "@opra/common": "^1.23.0",
15
+ "@opra/client": "^1.23.2",
16
+ "@opra/common": "^1.23.2",
17
17
  "expect": "^29.0.0 || ^30.0.0",
18
18
  "jest-matcher-utils": "^29.0.0 || ^30.0.0"
19
19
  },