@locustjs/test 1.6.4 → 2.0.1
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 +16 -4
- package/dist/index.js +621 -166
- package/package.json +39 -39
- package/rollup.config.js +16 -0
- package/src/Expect.js +1204 -0
- package/src/Test.js +88 -0
- package/src/TestException.js +5 -0
- package/src/TestRunner.js +331 -0
- package/src/index.js +5 -1598
- package/tests/index.js +4 -4
- package/.babelrc +0 -3
package/dist/index.js
CHANGED
|
@@ -1,46 +1,498 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
function
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
3
|
+
var base = require('@locustjs/base');
|
|
4
|
+
var fs = require('fs');
|
|
5
|
+
var path = require('path');
|
|
6
|
+
var exception = require('@locustjs/exception');
|
|
7
|
+
|
|
8
|
+
function _arrayLikeToArray(r, a) {
|
|
9
|
+
(null == a || a > r.length) && (a = r.length);
|
|
10
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
11
|
+
return n;
|
|
12
|
+
}
|
|
13
|
+
function _arrayWithoutHoles(r) {
|
|
14
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
15
|
+
}
|
|
16
|
+
function _assertThisInitialized(e) {
|
|
17
|
+
if (undefined === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
18
|
+
return e;
|
|
19
|
+
}
|
|
20
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
21
|
+
try {
|
|
22
|
+
var i = n[a](c),
|
|
23
|
+
u = i.value;
|
|
24
|
+
} catch (n) {
|
|
25
|
+
return void e(n);
|
|
26
|
+
}
|
|
27
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
28
|
+
}
|
|
29
|
+
function _asyncToGenerator(n) {
|
|
30
|
+
return function () {
|
|
31
|
+
var t = this,
|
|
32
|
+
e = arguments;
|
|
33
|
+
return new Promise(function (r, o) {
|
|
34
|
+
var a = n.apply(t, e);
|
|
35
|
+
function _next(n) {
|
|
36
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
37
|
+
}
|
|
38
|
+
function _throw(n) {
|
|
39
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
40
|
+
}
|
|
41
|
+
_next(undefined);
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function _callSuper(t, o, e) {
|
|
46
|
+
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
|
47
|
+
}
|
|
48
|
+
function _classCallCheck(a, n) {
|
|
49
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
50
|
+
}
|
|
51
|
+
function _defineProperties(e, r) {
|
|
52
|
+
for (var t = 0; t < r.length; t++) {
|
|
53
|
+
var o = r[t];
|
|
54
|
+
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function _createClass(e, r, t) {
|
|
58
|
+
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
59
|
+
writable: false
|
|
60
|
+
}), e;
|
|
61
|
+
}
|
|
62
|
+
function _createForOfIteratorHelper(r, e) {
|
|
63
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
64
|
+
if (!t) {
|
|
65
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
|
|
66
|
+
t && (r = t);
|
|
67
|
+
var n = 0,
|
|
68
|
+
F = function () {};
|
|
69
|
+
return {
|
|
70
|
+
s: F,
|
|
71
|
+
n: function () {
|
|
72
|
+
return n >= r.length ? {
|
|
73
|
+
done: true
|
|
74
|
+
} : {
|
|
75
|
+
done: false,
|
|
76
|
+
value: r[n++]
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
e: function (r) {
|
|
80
|
+
throw r;
|
|
81
|
+
},
|
|
82
|
+
f: F
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
86
|
+
}
|
|
87
|
+
var o,
|
|
88
|
+
a = true,
|
|
89
|
+
u = false;
|
|
90
|
+
return {
|
|
91
|
+
s: function () {
|
|
92
|
+
t = t.call(r);
|
|
93
|
+
},
|
|
94
|
+
n: function () {
|
|
95
|
+
var r = t.next();
|
|
96
|
+
return a = r.done, r;
|
|
97
|
+
},
|
|
98
|
+
e: function (r) {
|
|
99
|
+
u = true, o = r;
|
|
100
|
+
},
|
|
101
|
+
f: function () {
|
|
102
|
+
try {
|
|
103
|
+
a || null == t.return || t.return();
|
|
104
|
+
} finally {
|
|
105
|
+
if (u) throw o;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function _getPrototypeOf(t) {
|
|
111
|
+
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
112
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
113
|
+
}, _getPrototypeOf(t);
|
|
114
|
+
}
|
|
115
|
+
function _inherits(t, e) {
|
|
116
|
+
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
117
|
+
t.prototype = Object.create(e && e.prototype, {
|
|
118
|
+
constructor: {
|
|
119
|
+
value: t,
|
|
120
|
+
writable: true,
|
|
121
|
+
configurable: true
|
|
122
|
+
}
|
|
123
|
+
}), Object.defineProperty(t, "prototype", {
|
|
124
|
+
writable: false
|
|
125
|
+
}), e && _setPrototypeOf(t, e);
|
|
126
|
+
}
|
|
127
|
+
function _isNativeReflectConstruct() {
|
|
128
|
+
try {
|
|
129
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
130
|
+
} catch (t) {}
|
|
131
|
+
return (_isNativeReflectConstruct = function () {
|
|
132
|
+
return !!t;
|
|
133
|
+
})();
|
|
134
|
+
}
|
|
135
|
+
function _iterableToArray(r) {
|
|
136
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
137
|
+
}
|
|
138
|
+
function _nonIterableSpread() {
|
|
139
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
140
|
+
}
|
|
141
|
+
function _possibleConstructorReturn(t, e) {
|
|
142
|
+
if (e && ("object" == typeof e || "function" == typeof e)) return e;
|
|
143
|
+
if (undefined !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
144
|
+
return _assertThisInitialized(t);
|
|
145
|
+
}
|
|
146
|
+
function _regeneratorRuntime() {
|
|
147
|
+
_regeneratorRuntime = function () {
|
|
148
|
+
return e;
|
|
149
|
+
};
|
|
150
|
+
var t,
|
|
151
|
+
e = {},
|
|
152
|
+
r = Object.prototype,
|
|
153
|
+
n = r.hasOwnProperty,
|
|
154
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
155
|
+
t[e] = r.value;
|
|
156
|
+
},
|
|
157
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
158
|
+
a = i.iterator || "@@iterator",
|
|
159
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
160
|
+
u = i.toStringTag || "@@toStringTag";
|
|
161
|
+
function define(t, e, r) {
|
|
162
|
+
return Object.defineProperty(t, e, {
|
|
163
|
+
value: r,
|
|
164
|
+
enumerable: true,
|
|
165
|
+
configurable: true,
|
|
166
|
+
writable: true
|
|
167
|
+
}), t[e];
|
|
168
|
+
}
|
|
169
|
+
try {
|
|
170
|
+
define({}, "");
|
|
171
|
+
} catch (t) {
|
|
172
|
+
define = function (t, e, r) {
|
|
173
|
+
return t[e] = r;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function wrap(t, e, r, n) {
|
|
177
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
178
|
+
a = Object.create(i.prototype),
|
|
179
|
+
c = new Context(n || []);
|
|
180
|
+
return o(a, "_invoke", {
|
|
181
|
+
value: makeInvokeMethod(t, r, c)
|
|
182
|
+
}), a;
|
|
183
|
+
}
|
|
184
|
+
function tryCatch(t, e, r) {
|
|
185
|
+
try {
|
|
186
|
+
return {
|
|
187
|
+
type: "normal",
|
|
188
|
+
arg: t.call(e, r)
|
|
189
|
+
};
|
|
190
|
+
} catch (t) {
|
|
191
|
+
return {
|
|
192
|
+
type: "throw",
|
|
193
|
+
arg: t
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
e.wrap = wrap;
|
|
198
|
+
var h = "suspendedStart",
|
|
199
|
+
l = "suspendedYield",
|
|
200
|
+
f = "executing",
|
|
201
|
+
s = "completed",
|
|
202
|
+
y = {};
|
|
203
|
+
function Generator() {}
|
|
204
|
+
function GeneratorFunction() {}
|
|
205
|
+
function GeneratorFunctionPrototype() {}
|
|
206
|
+
var p = {};
|
|
207
|
+
define(p, a, function () {
|
|
208
|
+
return this;
|
|
209
|
+
});
|
|
210
|
+
var d = Object.getPrototypeOf,
|
|
211
|
+
v = d && d(d(values([])));
|
|
212
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
213
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
214
|
+
function defineIteratorMethods(t) {
|
|
215
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
216
|
+
define(t, e, function (t) {
|
|
217
|
+
return this._invoke(e, t);
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
function AsyncIterator(t, e) {
|
|
222
|
+
function invoke(r, o, i, a) {
|
|
223
|
+
var c = tryCatch(t[r], t, o);
|
|
224
|
+
if ("throw" !== c.type) {
|
|
225
|
+
var u = c.arg,
|
|
226
|
+
h = u.value;
|
|
227
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
228
|
+
invoke("next", t, i, a);
|
|
229
|
+
}, function (t) {
|
|
230
|
+
invoke("throw", t, i, a);
|
|
231
|
+
}) : e.resolve(h).then(function (t) {
|
|
232
|
+
u.value = t, i(u);
|
|
233
|
+
}, function (t) {
|
|
234
|
+
return invoke("throw", t, i, a);
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
a(c.arg);
|
|
238
|
+
}
|
|
239
|
+
var r;
|
|
240
|
+
o(this, "_invoke", {
|
|
241
|
+
value: function (t, n) {
|
|
242
|
+
function callInvokeWithMethodAndArg() {
|
|
243
|
+
return new e(function (e, r) {
|
|
244
|
+
invoke(t, n, e, r);
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function makeInvokeMethod(e, r, n) {
|
|
252
|
+
var o = h;
|
|
253
|
+
return function (i, a) {
|
|
254
|
+
if (o === f) throw Error("Generator is already running");
|
|
255
|
+
if (o === s) {
|
|
256
|
+
if ("throw" === i) throw a;
|
|
257
|
+
return {
|
|
258
|
+
value: t,
|
|
259
|
+
done: true
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
for (n.method = i, n.arg = a;;) {
|
|
263
|
+
var c = n.delegate;
|
|
264
|
+
if (c) {
|
|
265
|
+
var u = maybeInvokeDelegate(c, n);
|
|
266
|
+
if (u) {
|
|
267
|
+
if (u === y) continue;
|
|
268
|
+
return u;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
272
|
+
if (o === h) throw o = s, n.arg;
|
|
273
|
+
n.dispatchException(n.arg);
|
|
274
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
275
|
+
o = f;
|
|
276
|
+
var p = tryCatch(e, r, n);
|
|
277
|
+
if ("normal" === p.type) {
|
|
278
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
279
|
+
return {
|
|
280
|
+
value: p.arg,
|
|
281
|
+
done: n.done
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
function maybeInvokeDelegate(e, r) {
|
|
289
|
+
var n = r.method,
|
|
290
|
+
o = e.iterator[n];
|
|
291
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
292
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
293
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
294
|
+
var a = i.arg;
|
|
295
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
296
|
+
}
|
|
297
|
+
function pushTryEntry(t) {
|
|
298
|
+
var e = {
|
|
299
|
+
tryLoc: t[0]
|
|
300
|
+
};
|
|
301
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
302
|
+
}
|
|
303
|
+
function resetTryEntry(t) {
|
|
304
|
+
var e = t.completion || {};
|
|
305
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
306
|
+
}
|
|
307
|
+
function Context(t) {
|
|
308
|
+
this.tryEntries = [{
|
|
309
|
+
tryLoc: "root"
|
|
310
|
+
}], t.forEach(pushTryEntry, this), this.reset(true);
|
|
311
|
+
}
|
|
312
|
+
function values(e) {
|
|
313
|
+
if (e || "" === e) {
|
|
314
|
+
var r = e[a];
|
|
315
|
+
if (r) return r.call(e);
|
|
316
|
+
if ("function" == typeof e.next) return e;
|
|
317
|
+
if (!isNaN(e.length)) {
|
|
318
|
+
var o = -1,
|
|
319
|
+
i = function next() {
|
|
320
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = false, next;
|
|
321
|
+
return next.value = t, next.done = true, next;
|
|
322
|
+
};
|
|
323
|
+
return i.next = i;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
327
|
+
}
|
|
328
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
329
|
+
value: GeneratorFunctionPrototype,
|
|
330
|
+
configurable: true
|
|
331
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
332
|
+
value: GeneratorFunction,
|
|
333
|
+
configurable: true
|
|
334
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
335
|
+
var e = "function" == typeof t && t.constructor;
|
|
336
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
337
|
+
}, e.mark = function (t) {
|
|
338
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
339
|
+
}, e.awrap = function (t) {
|
|
340
|
+
return {
|
|
341
|
+
__await: t
|
|
342
|
+
};
|
|
343
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
344
|
+
return this;
|
|
345
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
346
|
+
undefined === i && (i = Promise);
|
|
347
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
348
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
349
|
+
return t.done ? t.value : a.next();
|
|
350
|
+
});
|
|
351
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
352
|
+
return this;
|
|
353
|
+
}), define(g, "toString", function () {
|
|
354
|
+
return "[object Generator]";
|
|
355
|
+
}), e.keys = function (t) {
|
|
356
|
+
var e = Object(t),
|
|
357
|
+
r = [];
|
|
358
|
+
for (var n in e) r.push(n);
|
|
359
|
+
return r.reverse(), function next() {
|
|
360
|
+
for (; r.length;) {
|
|
361
|
+
var t = r.pop();
|
|
362
|
+
if (t in e) return next.value = t, next.done = false, next;
|
|
363
|
+
}
|
|
364
|
+
return next.done = true, next;
|
|
365
|
+
};
|
|
366
|
+
}, e.values = values, Context.prototype = {
|
|
367
|
+
constructor: Context,
|
|
368
|
+
reset: function (e) {
|
|
369
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
370
|
+
},
|
|
371
|
+
stop: function () {
|
|
372
|
+
this.done = true;
|
|
373
|
+
var t = this.tryEntries[0].completion;
|
|
374
|
+
if ("throw" === t.type) throw t.arg;
|
|
375
|
+
return this.rval;
|
|
376
|
+
},
|
|
377
|
+
dispatchException: function (e) {
|
|
378
|
+
if (this.done) throw e;
|
|
379
|
+
var r = this;
|
|
380
|
+
function handle(n, o) {
|
|
381
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
382
|
+
}
|
|
383
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
384
|
+
var i = this.tryEntries[o],
|
|
385
|
+
a = i.completion;
|
|
386
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
387
|
+
if (i.tryLoc <= this.prev) {
|
|
388
|
+
var c = n.call(i, "catchLoc"),
|
|
389
|
+
u = n.call(i, "finallyLoc");
|
|
390
|
+
if (c && u) {
|
|
391
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
|
|
392
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
393
|
+
} else if (c) {
|
|
394
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
|
|
395
|
+
} else {
|
|
396
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
397
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
abrupt: function (t, e) {
|
|
403
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
404
|
+
var o = this.tryEntries[r];
|
|
405
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
406
|
+
var i = o;
|
|
407
|
+
break;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
411
|
+
var a = i ? i.completion : {};
|
|
412
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
413
|
+
},
|
|
414
|
+
complete: function (t, e) {
|
|
415
|
+
if ("throw" === t.type) throw t.arg;
|
|
416
|
+
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
417
|
+
},
|
|
418
|
+
finish: function (t) {
|
|
419
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
420
|
+
var r = this.tryEntries[e];
|
|
421
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
catch: function (t) {
|
|
425
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
426
|
+
var r = this.tryEntries[e];
|
|
427
|
+
if (r.tryLoc === t) {
|
|
428
|
+
var n = r.completion;
|
|
429
|
+
if ("throw" === n.type) {
|
|
430
|
+
var o = n.arg;
|
|
431
|
+
resetTryEntry(r);
|
|
432
|
+
}
|
|
433
|
+
return o;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
throw Error("illegal catch attempt");
|
|
437
|
+
},
|
|
438
|
+
delegateYield: function (e, r, n) {
|
|
439
|
+
return this.delegate = {
|
|
440
|
+
iterator: values(e),
|
|
441
|
+
resultName: r,
|
|
442
|
+
nextLoc: n
|
|
443
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
444
|
+
}
|
|
445
|
+
}, e;
|
|
446
|
+
}
|
|
447
|
+
function _setPrototypeOf(t, e) {
|
|
448
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
449
|
+
return t.__proto__ = e, t;
|
|
450
|
+
}, _setPrototypeOf(t, e);
|
|
451
|
+
}
|
|
452
|
+
function _toConsumableArray(r) {
|
|
453
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
454
|
+
}
|
|
455
|
+
function _toPrimitive(t, r) {
|
|
456
|
+
if ("object" != typeof t || !t) return t;
|
|
457
|
+
var e = t[Symbol.toPrimitive];
|
|
458
|
+
if (undefined !== e) {
|
|
459
|
+
var i = e.call(t, r);
|
|
460
|
+
if ("object" != typeof i) return i;
|
|
461
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
462
|
+
}
|
|
463
|
+
return (String )(t);
|
|
464
|
+
}
|
|
465
|
+
function _toPropertyKey(t) {
|
|
466
|
+
var i = _toPrimitive(t, "string");
|
|
467
|
+
return "symbol" == typeof i ? i : i + "";
|
|
468
|
+
}
|
|
469
|
+
function _typeof(o) {
|
|
470
|
+
"@babel/helpers - typeof";
|
|
471
|
+
|
|
472
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
473
|
+
return typeof o;
|
|
474
|
+
} : function (o) {
|
|
475
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
476
|
+
}, _typeof(o);
|
|
477
|
+
}
|
|
478
|
+
function _unsupportedIterableToArray(r, a) {
|
|
479
|
+
if (r) {
|
|
480
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
481
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
482
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : undefined;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
var TestException = /*#__PURE__*/function (_Exception) {
|
|
36
487
|
function TestException() {
|
|
37
488
|
_classCallCheck(this, TestException);
|
|
38
489
|
return _callSuper(this, TestException, arguments);
|
|
39
490
|
}
|
|
40
491
|
_inherits(TestException, _Exception);
|
|
41
492
|
return _createClass(TestException);
|
|
42
|
-
}(
|
|
43
|
-
|
|
493
|
+
}(exception.Exception);
|
|
494
|
+
|
|
495
|
+
var Expect = /*#__PURE__*/function () {
|
|
44
496
|
function Expect(value) {
|
|
45
497
|
_classCallCheck(this, Expect);
|
|
46
498
|
this.value = value;
|
|
@@ -55,7 +507,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
55
507
|
key: "toBe",
|
|
56
508
|
value: function toBe(value) {
|
|
57
509
|
this._expected = true;
|
|
58
|
-
if (this.value === value)
|
|
510
|
+
if (this.value === value) ; else {
|
|
59
511
|
throw new TestException({
|
|
60
512
|
message: "".concat(this.value, " is not equal to ").concat(value),
|
|
61
513
|
code: 1000,
|
|
@@ -205,7 +657,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
205
657
|
key: "toBeString",
|
|
206
658
|
value: function toBeString() {
|
|
207
659
|
this._expected = true;
|
|
208
|
-
if (!
|
|
660
|
+
if (!base.isString(this.value)) {
|
|
209
661
|
throw new TestException({
|
|
210
662
|
message: "".concat(this.value, " is not string"),
|
|
211
663
|
code: 1026,
|
|
@@ -218,7 +670,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
218
670
|
key: "notToBeString",
|
|
219
671
|
value: function notToBeString() {
|
|
220
672
|
this._expected = true;
|
|
221
|
-
if (
|
|
673
|
+
if (base.isString(this.value)) {
|
|
222
674
|
throw new TestException({
|
|
223
675
|
message: "".concat(this.value, " is string"),
|
|
224
676
|
code: 1046,
|
|
@@ -231,7 +683,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
231
683
|
key: "toBeSomeString",
|
|
232
684
|
value: function toBeSomeString() {
|
|
233
685
|
this._expected = true;
|
|
234
|
-
if (!
|
|
686
|
+
if (!base.isSomeString(this.value)) {
|
|
235
687
|
throw new TestException({
|
|
236
688
|
message: "".concat(this.value, " is not some string"),
|
|
237
689
|
code: 1027,
|
|
@@ -244,7 +696,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
244
696
|
key: "notToBeSomeString",
|
|
245
697
|
value: function notToBeSomeString() {
|
|
246
698
|
this._expected = true;
|
|
247
|
-
if (
|
|
699
|
+
if (base.isSomeString(this.value)) {
|
|
248
700
|
throw new TestException({
|
|
249
701
|
message: "".concat(this.value, " is some string"),
|
|
250
702
|
code: 1047,
|
|
@@ -257,7 +709,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
257
709
|
key: "toBeNumber",
|
|
258
710
|
value: function toBeNumber() {
|
|
259
711
|
this._expected = true;
|
|
260
|
-
if (!
|
|
712
|
+
if (!base.isNumber(this.value)) {
|
|
261
713
|
throw new TestException({
|
|
262
714
|
message: "".concat(this.value, " is not number"),
|
|
263
715
|
code: 1028,
|
|
@@ -270,7 +722,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
270
722
|
key: "notToBeNumber",
|
|
271
723
|
value: function notToBeNumber() {
|
|
272
724
|
this._expected = true;
|
|
273
|
-
if (
|
|
725
|
+
if (base.isNumber(this.value)) {
|
|
274
726
|
throw new TestException({
|
|
275
727
|
message: "".concat(this.value, " is number"),
|
|
276
728
|
code: 1048,
|
|
@@ -283,7 +735,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
283
735
|
key: "toBeDate",
|
|
284
736
|
value: function toBeDate() {
|
|
285
737
|
this._expected = true;
|
|
286
|
-
if (!
|
|
738
|
+
if (!base.isDate(this.value)) {
|
|
287
739
|
throw new TestException({
|
|
288
740
|
message: "".concat(this.value, " is not date"),
|
|
289
741
|
code: 1029,
|
|
@@ -296,7 +748,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
296
748
|
key: "notToBeDate",
|
|
297
749
|
value: function notToBeDate() {
|
|
298
750
|
this._expected = true;
|
|
299
|
-
if (
|
|
751
|
+
if (base.isDate(this.value)) {
|
|
300
752
|
throw new TestException({
|
|
301
753
|
message: "".concat(this.value, " is date"),
|
|
302
754
|
code: 1049,
|
|
@@ -309,7 +761,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
309
761
|
key: "toBeBool",
|
|
310
762
|
value: function toBeBool() {
|
|
311
763
|
this._expected = true;
|
|
312
|
-
if (!
|
|
764
|
+
if (!base.isBool(this.value)) {
|
|
313
765
|
throw new TestException({
|
|
314
766
|
message: "".concat(this.value, " is not bool"),
|
|
315
767
|
code: 1030,
|
|
@@ -322,7 +774,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
322
774
|
key: "notToBeBool",
|
|
323
775
|
value: function notToBeBool() {
|
|
324
776
|
this._expected = true;
|
|
325
|
-
if (
|
|
777
|
+
if (base.isBool(this.value)) {
|
|
326
778
|
throw new TestException({
|
|
327
779
|
message: "".concat(this.value, " is bool"),
|
|
328
780
|
code: 1050,
|
|
@@ -335,7 +787,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
335
787
|
key: "toBeBasicType",
|
|
336
788
|
value: function toBeBasicType() {
|
|
337
789
|
this._expected = true;
|
|
338
|
-
if (!
|
|
790
|
+
if (!base.isBasic(this.value)) {
|
|
339
791
|
throw new TestException({
|
|
340
792
|
message: "".concat(this.value, " is not basic type"),
|
|
341
793
|
code: 1031,
|
|
@@ -348,7 +800,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
348
800
|
key: "notToBeBasicType",
|
|
349
801
|
value: function notToBeBasicType() {
|
|
350
802
|
this._expected = true;
|
|
351
|
-
if (
|
|
803
|
+
if (base.isBasic(this.value)) {
|
|
352
804
|
throw new TestException({
|
|
353
805
|
message: "".concat(this.value, " is basic type"),
|
|
354
806
|
code: 1051,
|
|
@@ -361,7 +813,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
361
813
|
key: "toBePrimitive",
|
|
362
814
|
value: function toBePrimitive() {
|
|
363
815
|
this._expected = true;
|
|
364
|
-
if (!
|
|
816
|
+
if (!base.isPrimitive(this.value)) {
|
|
365
817
|
throw new TestException({
|
|
366
818
|
message: "".concat(this.value, " is not primitive type"),
|
|
367
819
|
code: 1032,
|
|
@@ -374,7 +826,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
374
826
|
key: "notToBePrimitive",
|
|
375
827
|
value: function notToBePrimitive() {
|
|
376
828
|
this._expected = true;
|
|
377
|
-
if (
|
|
829
|
+
if (base.isPrimitive(this.value)) {
|
|
378
830
|
throw new TestException({
|
|
379
831
|
message: "".concat(this.value, " is primitive type"),
|
|
380
832
|
code: 1052,
|
|
@@ -387,7 +839,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
387
839
|
key: "toBeEmpty",
|
|
388
840
|
value: function toBeEmpty() {
|
|
389
841
|
this._expected = true;
|
|
390
|
-
if (!
|
|
842
|
+
if (!base.isEmpty(this.value)) {
|
|
391
843
|
throw new TestException({
|
|
392
844
|
message: "".concat(this.value, " is not empty"),
|
|
393
845
|
code: 1033,
|
|
@@ -400,7 +852,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
400
852
|
key: "notToBeEmpty",
|
|
401
853
|
value: function notToBeEmpty() {
|
|
402
854
|
this._expected = true;
|
|
403
|
-
if (
|
|
855
|
+
if (base.isEmpty(this.value)) {
|
|
404
856
|
throw new TestException({
|
|
405
857
|
message: "".concat(this.value, " is empty"),
|
|
406
858
|
code: 1053,
|
|
@@ -413,7 +865,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
413
865
|
key: "toBeObject",
|
|
414
866
|
value: function toBeObject() {
|
|
415
867
|
this._expected = true;
|
|
416
|
-
if (!
|
|
868
|
+
if (!base.isObject(this.value)) {
|
|
417
869
|
throw new TestException({
|
|
418
870
|
message: "".concat(this.value, " is not object"),
|
|
419
871
|
code: 1034,
|
|
@@ -426,7 +878,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
426
878
|
key: "notToBeObject",
|
|
427
879
|
value: function notToBeObject() {
|
|
428
880
|
this._expected = true;
|
|
429
|
-
if (
|
|
881
|
+
if (base.isObject(this.value)) {
|
|
430
882
|
throw new TestException({
|
|
431
883
|
message: "".concat(this.value, " is object"),
|
|
432
884
|
code: 1054,
|
|
@@ -439,7 +891,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
439
891
|
key: "toBeSomeObject",
|
|
440
892
|
value: function toBeSomeObject() {
|
|
441
893
|
this._expected = true;
|
|
442
|
-
if (!
|
|
894
|
+
if (!base.isSomeObject(this.value)) {
|
|
443
895
|
throw new TestException({
|
|
444
896
|
message: "".concat(this.value, " is not some object"),
|
|
445
897
|
code: 1035,
|
|
@@ -452,7 +904,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
452
904
|
key: "notToBeSomeObject",
|
|
453
905
|
value: function notToBeSomeObject() {
|
|
454
906
|
this._expected = true;
|
|
455
|
-
if (
|
|
907
|
+
if (base.isSomeObject(this.value)) {
|
|
456
908
|
throw new TestException({
|
|
457
909
|
message: "".concat(this.value, " is some object"),
|
|
458
910
|
code: 1055,
|
|
@@ -465,7 +917,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
465
917
|
key: "toBeFunction",
|
|
466
918
|
value: function toBeFunction() {
|
|
467
919
|
this._expected = true;
|
|
468
|
-
if (!
|
|
920
|
+
if (!base.isFunction(this.value)) {
|
|
469
921
|
throw new TestException({
|
|
470
922
|
message: "".concat(this.value, " is not function"),
|
|
471
923
|
code: 1036,
|
|
@@ -478,7 +930,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
478
930
|
key: "notToBeFunction",
|
|
479
931
|
value: function notToBeFunction() {
|
|
480
932
|
this._expected = true;
|
|
481
|
-
if (
|
|
933
|
+
if (base.isFunction(this.value)) {
|
|
482
934
|
throw new TestException({
|
|
483
935
|
message: "".concat(this.value, " is function"),
|
|
484
936
|
code: 1056,
|
|
@@ -491,7 +943,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
491
943
|
key: "toBeNumeric",
|
|
492
944
|
value: function toBeNumeric() {
|
|
493
945
|
this._expected = true;
|
|
494
|
-
if (!
|
|
946
|
+
if (!base.isNumeric(this.value)) {
|
|
495
947
|
throw new TestException({
|
|
496
948
|
message: "".concat(this.value, " is not numeric"),
|
|
497
949
|
code: 1037,
|
|
@@ -504,7 +956,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
504
956
|
key: "notToBeNumeric",
|
|
505
957
|
value: function notToBeNumeric() {
|
|
506
958
|
this._expected = true;
|
|
507
|
-
if (
|
|
959
|
+
if (base.isNumeric(this.value)) {
|
|
508
960
|
throw new TestException({
|
|
509
961
|
message: "".concat(this.value, " is numeric"),
|
|
510
962
|
code: 1057,
|
|
@@ -517,7 +969,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
517
969
|
key: "toBeArray",
|
|
518
970
|
value: function toBeArray() {
|
|
519
971
|
this._expected = true;
|
|
520
|
-
if (!
|
|
972
|
+
if (!base.isArray(this.value)) {
|
|
521
973
|
throw new TestException({
|
|
522
974
|
message: "".concat(this.value, " is not array"),
|
|
523
975
|
code: 1038,
|
|
@@ -530,7 +982,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
530
982
|
key: "notToBeArray",
|
|
531
983
|
value: function notToBeArray() {
|
|
532
984
|
this._expected = true;
|
|
533
|
-
if (
|
|
985
|
+
if (base.isArray(this.value)) {
|
|
534
986
|
throw new TestException({
|
|
535
987
|
message: "".concat(this.value, " is array"),
|
|
536
988
|
code: 1058,
|
|
@@ -543,7 +995,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
543
995
|
key: "toBeSomeArray",
|
|
544
996
|
value: function toBeSomeArray() {
|
|
545
997
|
this._expected = true;
|
|
546
|
-
if (!
|
|
998
|
+
if (!base.isSomeArray(this.value)) {
|
|
547
999
|
throw new TestException({
|
|
548
1000
|
message: "".concat(this.value, " is not some array"),
|
|
549
1001
|
code: 1039,
|
|
@@ -556,7 +1008,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
556
1008
|
key: "notToBeSomeArray",
|
|
557
1009
|
value: function notToBeSomeArray() {
|
|
558
1010
|
this._expected = true;
|
|
559
|
-
if (!
|
|
1011
|
+
if (!base.isArray(this.value)) {
|
|
560
1012
|
throw new TestException({
|
|
561
1013
|
message: "".concat(this.value, " is not array"),
|
|
562
1014
|
code: 1068,
|
|
@@ -576,7 +1028,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
576
1028
|
key: "toBeIterable",
|
|
577
1029
|
value: function toBeIterable() {
|
|
578
1030
|
this._expected = true;
|
|
579
|
-
if (!
|
|
1031
|
+
if (!base.isIterable(this.value)) {
|
|
580
1032
|
throw new TestException({
|
|
581
1033
|
message: "".concat(this.value, " is not iterable"),
|
|
582
1034
|
code: 1040,
|
|
@@ -589,7 +1041,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
589
1041
|
key: "notToBeIterable",
|
|
590
1042
|
value: function notToBeIterable() {
|
|
591
1043
|
this._expected = true;
|
|
592
|
-
if (
|
|
1044
|
+
if (base.isIterable(this.value)) {
|
|
593
1045
|
throw new TestException({
|
|
594
1046
|
message: "".concat(this.value, " is iterable"),
|
|
595
1047
|
code: 1060,
|
|
@@ -602,7 +1054,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
602
1054
|
key: "toBeSubClassOf",
|
|
603
1055
|
value: function toBeSubClassOf(type) {
|
|
604
1056
|
this._expected = true;
|
|
605
|
-
if (!
|
|
1057
|
+
if (!base.isSubClassOf(this.value, type)) {
|
|
606
1058
|
throw new TestException({
|
|
607
1059
|
message: "".concat(this.value, " is not subclass of ").concat(type),
|
|
608
1060
|
code: 1041,
|
|
@@ -615,7 +1067,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
615
1067
|
key: "notToBeSubClassOf",
|
|
616
1068
|
value: function notToBeSubClassOf(type) {
|
|
617
1069
|
this._expected = true;
|
|
618
|
-
if (
|
|
1070
|
+
if (base.isSubClassOf(this.value, type)) {
|
|
619
1071
|
throw new TestException({
|
|
620
1072
|
message: "".concat(this.value, " is subclass of ").concat(type),
|
|
621
1073
|
code: 1061,
|
|
@@ -774,7 +1226,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
774
1226
|
key: "toBeNullOrUndefined",
|
|
775
1227
|
value: function toBeNullOrUndefined() {
|
|
776
1228
|
this._expected = true;
|
|
777
|
-
if (this.value == null)
|
|
1229
|
+
if (this.value == null) ; else {
|
|
778
1230
|
throw new TestException({
|
|
779
1231
|
message: "value is not null/undefined",
|
|
780
1232
|
code: 1010,
|
|
@@ -800,7 +1252,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
800
1252
|
key: "toBeEmptyArray",
|
|
801
1253
|
value: function toBeEmptyArray() {
|
|
802
1254
|
this._expected = true;
|
|
803
|
-
if (
|
|
1255
|
+
if (base.isSomeArray(this.value)) {
|
|
804
1256
|
throw new TestException({
|
|
805
1257
|
message: "".concat(this.value, " is some array"),
|
|
806
1258
|
code: 1059,
|
|
@@ -813,7 +1265,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
813
1265
|
key: "toBeValid",
|
|
814
1266
|
value: function toBeValid(fnValidation) {
|
|
815
1267
|
this._expected = true;
|
|
816
|
-
if (!
|
|
1268
|
+
if (!base.isFunction(fnValidation)) {
|
|
817
1269
|
throw new TestException({
|
|
818
1270
|
message: "fnValidation is not function",
|
|
819
1271
|
code: 1064,
|
|
@@ -833,7 +1285,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
833
1285
|
key: "notToBeValid",
|
|
834
1286
|
value: function notToBeValid(fnValidation) {
|
|
835
1287
|
this._expected = true;
|
|
836
|
-
if (!
|
|
1288
|
+
if (!base.isFunction(fnValidation)) {
|
|
837
1289
|
throw new TestException({
|
|
838
1290
|
message: "fnValidation is not function",
|
|
839
1291
|
code: 1066,
|
|
@@ -855,7 +1307,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
855
1307
|
var shape = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
856
1308
|
var strict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
857
1309
|
this._expected = true;
|
|
858
|
-
if (!
|
|
1310
|
+
if (!base.isFunction(this.value)) {
|
|
859
1311
|
throw new TestException({
|
|
860
1312
|
message: "given argument is not a function.",
|
|
861
1313
|
code: 1012,
|
|
@@ -868,7 +1320,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
868
1320
|
ok = true;
|
|
869
1321
|
} catch (e) {
|
|
870
1322
|
if (ex !== undefined) {
|
|
871
|
-
if (
|
|
1323
|
+
if (base.isPrimitive(ex)) {
|
|
872
1324
|
if (e !== ex) {
|
|
873
1325
|
throw new TestException({
|
|
874
1326
|
message: "given function threw incorrect error.",
|
|
@@ -876,7 +1328,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
876
1328
|
status: "incorrect-throw-error"
|
|
877
1329
|
});
|
|
878
1330
|
}
|
|
879
|
-
} else if (
|
|
1331
|
+
} else if (base.isFunction(ex)) {
|
|
880
1332
|
if (!(e instanceof ex)) {
|
|
881
1333
|
throw new TestException({
|
|
882
1334
|
message: "given function threw incorrect instance.",
|
|
@@ -884,9 +1336,9 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
884
1336
|
status: "incorrect-throw-instance"
|
|
885
1337
|
});
|
|
886
1338
|
}
|
|
887
|
-
} else if (
|
|
1339
|
+
} else if (base.isObject(ex)) {
|
|
888
1340
|
if (shape) {
|
|
889
|
-
if (!
|
|
1341
|
+
if (!base.equals(e, ex, strict)) {
|
|
890
1342
|
throw new TestException({
|
|
891
1343
|
message: "given function threw incorrect object shape.",
|
|
892
1344
|
code: 1020,
|
|
@@ -930,7 +1382,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
930
1382
|
var shape = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
931
1383
|
var strict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
932
1384
|
this._expected = true;
|
|
933
|
-
if (!
|
|
1385
|
+
if (!base.isFunction(this.value)) {
|
|
934
1386
|
throw new TestException({
|
|
935
1387
|
message: "given argument is not a function.",
|
|
936
1388
|
code: 1012,
|
|
@@ -945,7 +1397,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
945
1397
|
} catch (e) {
|
|
946
1398
|
error = e;
|
|
947
1399
|
if (ex !== undefined) {
|
|
948
|
-
if (
|
|
1400
|
+
if (base.isPrimitive(ex)) {
|
|
949
1401
|
if (e === ex) {
|
|
950
1402
|
throw new TestException({
|
|
951
1403
|
message: "given function threw incorrect error.",
|
|
@@ -953,7 +1405,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
953
1405
|
status: "incorrect-throw-error"
|
|
954
1406
|
});
|
|
955
1407
|
}
|
|
956
|
-
} else if (
|
|
1408
|
+
} else if (base.isFunction(ex)) {
|
|
957
1409
|
if (e instanceof ex) {
|
|
958
1410
|
throw new TestException({
|
|
959
1411
|
message: "given function threw incorrect instance.",
|
|
@@ -961,9 +1413,9 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
961
1413
|
status: "incorrect-throw-instance"
|
|
962
1414
|
});
|
|
963
1415
|
}
|
|
964
|
-
} else if (
|
|
1416
|
+
} else if (base.isObject(ex)) {
|
|
965
1417
|
if (shape) {
|
|
966
|
-
if (
|
|
1418
|
+
if (base.equals(e, ex, strict)) {
|
|
967
1419
|
throw new TestException({
|
|
968
1420
|
message: "given function threw incorrect object shape.",
|
|
969
1421
|
code: 1020,
|
|
@@ -1016,7 +1468,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
1016
1468
|
shape = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
|
|
1017
1469
|
strict = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
|
|
1018
1470
|
this._expected = true;
|
|
1019
|
-
if (
|
|
1471
|
+
if (base.isFunction(this.value)) {
|
|
1020
1472
|
_context.next = 5;
|
|
1021
1473
|
break;
|
|
1022
1474
|
}
|
|
@@ -1041,7 +1493,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
1041
1493
|
_context.next = 39;
|
|
1042
1494
|
break;
|
|
1043
1495
|
}
|
|
1044
|
-
if (!
|
|
1496
|
+
if (!base.isPrimitive(ex)) {
|
|
1045
1497
|
_context.next = 20;
|
|
1046
1498
|
break;
|
|
1047
1499
|
}
|
|
@@ -1058,7 +1510,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
1058
1510
|
_context.next = 37;
|
|
1059
1511
|
break;
|
|
1060
1512
|
case 20:
|
|
1061
|
-
if (!
|
|
1513
|
+
if (!base.isFunction(ex)) {
|
|
1062
1514
|
_context.next = 25;
|
|
1063
1515
|
break;
|
|
1064
1516
|
}
|
|
@@ -1075,7 +1527,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
1075
1527
|
_context.next = 37;
|
|
1076
1528
|
break;
|
|
1077
1529
|
case 25:
|
|
1078
|
-
if (!
|
|
1530
|
+
if (!base.isObject(ex)) {
|
|
1079
1531
|
_context.next = 35;
|
|
1080
1532
|
break;
|
|
1081
1533
|
}
|
|
@@ -1083,7 +1535,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
1083
1535
|
_context.next = 31;
|
|
1084
1536
|
break;
|
|
1085
1537
|
}
|
|
1086
|
-
if (
|
|
1538
|
+
if (base.equals(_context.t0, ex, strict)) {
|
|
1087
1539
|
_context.next = 29;
|
|
1088
1540
|
break;
|
|
1089
1541
|
}
|
|
@@ -1161,7 +1613,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
1161
1613
|
shape = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : false;
|
|
1162
1614
|
strict = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : false;
|
|
1163
1615
|
this._expected = true;
|
|
1164
|
-
if (
|
|
1616
|
+
if (base.isFunction(this.value)) {
|
|
1165
1617
|
_context2.next = 5;
|
|
1166
1618
|
break;
|
|
1167
1619
|
}
|
|
@@ -1187,7 +1639,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
1187
1639
|
_context2.next = 40;
|
|
1188
1640
|
break;
|
|
1189
1641
|
}
|
|
1190
|
-
if (!
|
|
1642
|
+
if (!base.isPrimitive(ex)) {
|
|
1191
1643
|
_context2.next = 21;
|
|
1192
1644
|
break;
|
|
1193
1645
|
}
|
|
@@ -1204,7 +1656,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
1204
1656
|
_context2.next = 38;
|
|
1205
1657
|
break;
|
|
1206
1658
|
case 21:
|
|
1207
|
-
if (!
|
|
1659
|
+
if (!base.isFunction(ex)) {
|
|
1208
1660
|
_context2.next = 26;
|
|
1209
1661
|
break;
|
|
1210
1662
|
}
|
|
@@ -1221,7 +1673,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
1221
1673
|
_context2.next = 38;
|
|
1222
1674
|
break;
|
|
1223
1675
|
case 26:
|
|
1224
|
-
if (!
|
|
1676
|
+
if (!base.isObject(ex)) {
|
|
1225
1677
|
_context2.next = 36;
|
|
1226
1678
|
break;
|
|
1227
1679
|
}
|
|
@@ -1229,7 +1681,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
1229
1681
|
_context2.next = 32;
|
|
1230
1682
|
break;
|
|
1231
1683
|
}
|
|
1232
|
-
if (!
|
|
1684
|
+
if (!base.equals(_context2.t0, ex, strict)) {
|
|
1233
1685
|
_context2.next = 30;
|
|
1234
1686
|
break;
|
|
1235
1687
|
}
|
|
@@ -1297,7 +1749,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
1297
1749
|
key: "toBeTruthy",
|
|
1298
1750
|
value: function toBeTruthy() {
|
|
1299
1751
|
this._expected = true;
|
|
1300
|
-
if (this.value)
|
|
1752
|
+
if (this.value) ; else {
|
|
1301
1753
|
throw new TestException({
|
|
1302
1754
|
message: "".concat(this.value, " is not truthy"),
|
|
1303
1755
|
code: 1015,
|
|
@@ -1315,7 +1767,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
1315
1767
|
key: "toBeFalsy",
|
|
1316
1768
|
value: function toBeFalsy() {
|
|
1317
1769
|
this._expected = true;
|
|
1318
|
-
if (!this.value)
|
|
1770
|
+
if (!this.value) ; else {
|
|
1319
1771
|
throw new TestException({
|
|
1320
1772
|
message: "".concat(this.value, " is not falsy"),
|
|
1321
1773
|
code: 1016,
|
|
@@ -1333,7 +1785,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
1333
1785
|
key: "toBeNaN",
|
|
1334
1786
|
value: function toBeNaN() {
|
|
1335
1787
|
this._expected = true;
|
|
1336
|
-
if (isNaN(this.value))
|
|
1788
|
+
if (isNaN(this.value)) ; else {
|
|
1337
1789
|
throw new TestException({
|
|
1338
1790
|
message: "".concat(this.value, " is not NaN"),
|
|
1339
1791
|
code: 1017,
|
|
@@ -1346,7 +1798,7 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
1346
1798
|
key: "notToBeNaN",
|
|
1347
1799
|
value: function notToBeNaN() {
|
|
1348
1800
|
this._expected = true;
|
|
1349
|
-
if (!isNaN(this.value))
|
|
1801
|
+
if (!isNaN(this.value)) ; else {
|
|
1350
1802
|
throw new TestException({
|
|
1351
1803
|
message: "".concat(this.value, " is NaN"),
|
|
1352
1804
|
code: 1023,
|
|
@@ -1357,7 +1809,8 @@ var Expect = exports.Expect = /*#__PURE__*/function () {
|
|
|
1357
1809
|
}
|
|
1358
1810
|
}]);
|
|
1359
1811
|
}();
|
|
1360
|
-
|
|
1812
|
+
|
|
1813
|
+
var Test = /*#__PURE__*/function () {
|
|
1361
1814
|
function Test(name, fn) {
|
|
1362
1815
|
_classCallCheck(this, Test);
|
|
1363
1816
|
this.name = name;
|
|
@@ -1369,14 +1822,14 @@ var Test = exports.Test = /*#__PURE__*/function () {
|
|
|
1369
1822
|
var _this = this;
|
|
1370
1823
|
return new Promise(function (res) {
|
|
1371
1824
|
var start = new Date();
|
|
1372
|
-
if (
|
|
1825
|
+
if (base.isFunction(_this.fn)) {
|
|
1373
1826
|
var _expect = new Expect();
|
|
1374
1827
|
try {
|
|
1375
1828
|
var _result = _this.fn(function (x) {
|
|
1376
1829
|
_expect.value = x;
|
|
1377
1830
|
return _expect;
|
|
1378
1831
|
});
|
|
1379
|
-
if (_result &&
|
|
1832
|
+
if (_result && base.isFunction(_result.then)) {
|
|
1380
1833
|
_result.then(function (result) {
|
|
1381
1834
|
res({
|
|
1382
1835
|
success: true,
|
|
@@ -1438,31 +1891,15 @@ var Test = exports.Test = /*#__PURE__*/function () {
|
|
|
1438
1891
|
}
|
|
1439
1892
|
}]);
|
|
1440
1893
|
}();
|
|
1894
|
+
|
|
1441
1895
|
var reset = "\x1b[0m";
|
|
1442
1896
|
var bright = "\x1b[1m";
|
|
1443
|
-
var dim = "\x1b[2m";
|
|
1444
|
-
var underscore = "\x1b[4m";
|
|
1445
|
-
var blink = "\x1b[5m";
|
|
1446
|
-
var reverse = "\x1b[7m";
|
|
1447
|
-
var hidden = "\x1b[8m";
|
|
1448
|
-
var fgBlack = "\x1b[30m";
|
|
1449
1897
|
var fgRed = "\x1b[31m";
|
|
1450
1898
|
var fgGreen = "\x1b[32m";
|
|
1451
1899
|
var fgYellow = "\x1b[33m";
|
|
1452
|
-
var fgBlue = "\x1b[34m";
|
|
1453
1900
|
var fgMagenta = "\x1b[35m";
|
|
1454
|
-
var fgCyan = "\x1b[36m";
|
|
1455
1901
|
var fgWhite = "\x1b[37m";
|
|
1456
1902
|
var fgGray = "\x1b[90m";
|
|
1457
|
-
var bgBlack = "\x1b[40m";
|
|
1458
|
-
var bgRed = "\x1b[41m";
|
|
1459
|
-
var bgGreen = "\x1b[42m";
|
|
1460
|
-
var bgYellow = "\x1b[43m";
|
|
1461
|
-
var bgBlue = "\x1b[44m";
|
|
1462
|
-
var bgMagenta = "\x1b[45m";
|
|
1463
|
-
var bgCyan = "\x1b[46m";
|
|
1464
|
-
var bgWhite = "\x1b[47m";
|
|
1465
|
-
var bgGray = "\x1b[100m";
|
|
1466
1903
|
var TestRunner = /*#__PURE__*/function () {
|
|
1467
1904
|
function TestRunner() {
|
|
1468
1905
|
_classCallCheck(this, TestRunner);
|
|
@@ -1481,12 +1918,12 @@ var TestRunner = /*#__PURE__*/function () {
|
|
|
1481
1918
|
}, {
|
|
1482
1919
|
key: "_runSingle",
|
|
1483
1920
|
value: function () {
|
|
1484
|
-
var _runSingle2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1921
|
+
var _runSingle2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(test, onProgress, i) {
|
|
1485
1922
|
var tr;
|
|
1486
|
-
return _regeneratorRuntime().wrap(function
|
|
1487
|
-
while (1) switch (
|
|
1923
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1924
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1488
1925
|
case 0:
|
|
1489
|
-
if (
|
|
1926
|
+
if (base.isFunction(onProgress)) {
|
|
1490
1927
|
try {
|
|
1491
1928
|
onProgress({
|
|
1492
1929
|
source: this,
|
|
@@ -1506,12 +1943,28 @@ var TestRunner = /*#__PURE__*/function () {
|
|
|
1506
1943
|
});
|
|
1507
1944
|
}
|
|
1508
1945
|
}
|
|
1509
|
-
|
|
1946
|
+
if (test instanceof Test) {
|
|
1947
|
+
_context.next = 6;
|
|
1948
|
+
break;
|
|
1949
|
+
}
|
|
1950
|
+
this._unknown++;
|
|
1951
|
+
this._errors.push({
|
|
1952
|
+
index: i,
|
|
1953
|
+
err: new TestException({
|
|
1954
|
+
message: "Given test is not an instance of '@locustjs/test:Test' class.",
|
|
1955
|
+
code: 1504,
|
|
1956
|
+
status: "invalid-test"
|
|
1957
|
+
})
|
|
1958
|
+
});
|
|
1959
|
+
_context.next = 11;
|
|
1960
|
+
break;
|
|
1961
|
+
case 6:
|
|
1962
|
+
_context.next = 8;
|
|
1510
1963
|
return test.run();
|
|
1511
|
-
case
|
|
1512
|
-
tr =
|
|
1964
|
+
case 8:
|
|
1965
|
+
tr = _context.sent;
|
|
1513
1966
|
this._results.push(tr);
|
|
1514
|
-
if (
|
|
1967
|
+
if (base.isObject(tr.err)) {
|
|
1515
1968
|
if (!tr.expected) {
|
|
1516
1969
|
this._faulted++;
|
|
1517
1970
|
} else {
|
|
@@ -1524,13 +1977,13 @@ var TestRunner = /*#__PURE__*/function () {
|
|
|
1524
1977
|
} else {
|
|
1525
1978
|
this._failed++;
|
|
1526
1979
|
}
|
|
1527
|
-
case
|
|
1980
|
+
case 11:
|
|
1528
1981
|
case "end":
|
|
1529
|
-
return
|
|
1982
|
+
return _context.stop();
|
|
1530
1983
|
}
|
|
1531
|
-
},
|
|
1984
|
+
}, _callee, this);
|
|
1532
1985
|
}));
|
|
1533
|
-
function _runSingle(
|
|
1986
|
+
function _runSingle(_x, _x2, _x3) {
|
|
1534
1987
|
return _runSingle2.apply(this, arguments);
|
|
1535
1988
|
}
|
|
1536
1989
|
return _runSingle;
|
|
@@ -1549,31 +2002,29 @@ var TestRunner = /*#__PURE__*/function () {
|
|
|
1549
2002
|
}, {
|
|
1550
2003
|
key: "run",
|
|
1551
2004
|
value: function run(tests, onProgress) {
|
|
1552
|
-
var
|
|
2005
|
+
var _this = this;
|
|
1553
2006
|
this._init();
|
|
1554
2007
|
return new Promise(function (res) {
|
|
1555
2008
|
if (tests) {
|
|
1556
2009
|
if (tests instanceof Test) {
|
|
1557
2010
|
tests = [tests];
|
|
1558
2011
|
}
|
|
1559
|
-
if (
|
|
2012
|
+
if (base.isArray(tests)) {
|
|
1560
2013
|
var _tests = tests.map(function (test) {
|
|
1561
2014
|
var _test = test;
|
|
1562
|
-
if (
|
|
2015
|
+
if (base.isArray(test)) {
|
|
1563
2016
|
if (test.length == 2) {
|
|
1564
2017
|
_test = new Test(test[0], test[1]);
|
|
1565
2018
|
}
|
|
1566
2019
|
}
|
|
1567
2020
|
return _test;
|
|
1568
|
-
}).filter(function (test) {
|
|
1569
|
-
return test instanceof Test;
|
|
1570
2021
|
}).map(function (test, i) {
|
|
1571
|
-
return
|
|
2022
|
+
return _this._runSingle(test, onProgress, i);
|
|
1572
2023
|
});
|
|
1573
2024
|
Promise.all(_tests).then(function (_) {
|
|
1574
|
-
return res(
|
|
2025
|
+
return res(_this.result);
|
|
1575
2026
|
})["catch"](function (ex) {
|
|
1576
|
-
|
|
2027
|
+
_this._errors.push({
|
|
1577
2028
|
err: new TestException({
|
|
1578
2029
|
message: "not all tests succeeded. check errors.",
|
|
1579
2030
|
code: 1503,
|
|
@@ -1581,27 +2032,27 @@ var TestRunner = /*#__PURE__*/function () {
|
|
|
1581
2032
|
innerException: ex
|
|
1582
2033
|
})
|
|
1583
2034
|
});
|
|
1584
|
-
res(
|
|
2035
|
+
res(_this.result);
|
|
1585
2036
|
});
|
|
1586
2037
|
} else {
|
|
1587
|
-
|
|
2038
|
+
_this._errors.push({
|
|
1588
2039
|
err: new TestException({
|
|
1589
2040
|
message: "invalid tests. expected array or a single test.",
|
|
1590
2041
|
code: 1502,
|
|
1591
2042
|
status: "invalid-tests"
|
|
1592
2043
|
})
|
|
1593
2044
|
});
|
|
1594
|
-
res(
|
|
2045
|
+
res(_this.result);
|
|
1595
2046
|
}
|
|
1596
2047
|
} else {
|
|
1597
|
-
|
|
2048
|
+
_this._errors.push({
|
|
1598
2049
|
err: new TestException({
|
|
1599
2050
|
message: "no tests given to be ran.",
|
|
1600
2051
|
code: 1501,
|
|
1601
2052
|
status: "no-tests"
|
|
1602
2053
|
})
|
|
1603
2054
|
});
|
|
1604
|
-
res(
|
|
2055
|
+
res(_this.result);
|
|
1605
2056
|
}
|
|
1606
2057
|
});
|
|
1607
2058
|
}
|
|
@@ -1613,19 +2064,19 @@ var TestRunner = /*#__PURE__*/function () {
|
|
|
1613
2064
|
}, {
|
|
1614
2065
|
key: "report",
|
|
1615
2066
|
value: function report(detailed) {
|
|
1616
|
-
var
|
|
2067
|
+
var _this2 = this;
|
|
1617
2068
|
var time = 0;
|
|
1618
2069
|
console.log("Finished.\n");
|
|
1619
2070
|
var _loop = function _loop() {
|
|
1620
|
-
var testResult =
|
|
1621
|
-
var t = "(".concat(
|
|
2071
|
+
var testResult = _this2._results[i];
|
|
2072
|
+
var t = "(".concat(_this2._getTime(testResult.time), ")");
|
|
1622
2073
|
if (detailed) {
|
|
1623
2074
|
var message = "\n" + (i + 1) + ". ";
|
|
1624
|
-
var err =
|
|
2075
|
+
var err = base.isObject(testResult.err) ? testResult.err.toString().split("\n") : [];
|
|
1625
2076
|
err = err.map(function (msg, i) {
|
|
1626
2077
|
return "\t".concat(i == err.length - 1 ? "".concat(fgYellow) : "".concat(fgGray, "error ").concat(testResult.err.code, ": ")).concat(msg).concat(reset);
|
|
1627
2078
|
}).join("\n");
|
|
1628
|
-
if (
|
|
2079
|
+
if (base.isObject(testResult.err)) {
|
|
1629
2080
|
if (!testResult.expected) {
|
|
1630
2081
|
message += "".concat(bright).concat(fgWhite).concat(testResult.test, ": ").concat(fgYellow, "faulted").concat(reset, " ").concat(t);
|
|
1631
2082
|
message += "\n";
|
|
@@ -1694,18 +2145,18 @@ var TestRunner = /*#__PURE__*/function () {
|
|
|
1694
2145
|
var seconds = d.getSeconds().toString().padStart(2, "0");
|
|
1695
2146
|
filename = "test-".concat(year, "-").concat(month, "-").concat(day, "-").concat(hours).concat(minutes).concat(seconds, ".json");
|
|
1696
2147
|
}
|
|
1697
|
-
var filepath =
|
|
2148
|
+
var filepath = path.join(process.cwd(), filename);
|
|
1698
2149
|
try {
|
|
1699
|
-
|
|
2150
|
+
fs.writeFileSync(filepath, content);
|
|
1700
2151
|
console.log("tests outcome wrote in ".concat(filename, "."));
|
|
1701
2152
|
} catch (ex) {
|
|
1702
|
-
console.log("writing tests
|
|
2153
|
+
console.log("writing tests' report failed.\n" + ex);
|
|
1703
2154
|
}
|
|
1704
2155
|
}
|
|
1705
2156
|
}, {
|
|
1706
2157
|
key: "test",
|
|
1707
2158
|
value: function () {
|
|
1708
|
-
var _test2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2159
|
+
var _test2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
1709
2160
|
var _ref;
|
|
1710
2161
|
var lastArg,
|
|
1711
2162
|
detailed,
|
|
@@ -1713,35 +2164,35 @@ var TestRunner = /*#__PURE__*/function () {
|
|
|
1713
2164
|
i,
|
|
1714
2165
|
t,
|
|
1715
2166
|
result,
|
|
1716
|
-
|
|
1717
|
-
return _regeneratorRuntime().wrap(function
|
|
1718
|
-
while (1) switch (
|
|
2167
|
+
_args2 = arguments;
|
|
2168
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2169
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1719
2170
|
case 0:
|
|
1720
|
-
lastArg = (_ref =
|
|
1721
|
-
detailed =
|
|
2171
|
+
lastArg = (_ref = _args2.length - 1, _ref < 0 || _args2.length <= _ref ? undefined : _args2[_ref]);
|
|
2172
|
+
detailed = _args2.length && base.isBool(lastArg) ? lastArg : false;
|
|
1722
2173
|
_tests = [];
|
|
1723
|
-
for (i = 0; i <
|
|
1724
|
-
t = i < 0 ||
|
|
1725
|
-
if (i !=
|
|
1726
|
-
if (
|
|
2174
|
+
for (i = 0; i < _args2.length; i++) {
|
|
2175
|
+
t = i < 0 || _args2.length <= i ? undefined : _args2[i];
|
|
2176
|
+
if (i != _args2.length - 1 || !base.isBool(t)) {
|
|
2177
|
+
if (base.isIterable(t)) {
|
|
1727
2178
|
_tests = [].concat(_toConsumableArray(_tests), _toConsumableArray(t));
|
|
1728
2179
|
}
|
|
1729
2180
|
}
|
|
1730
2181
|
}
|
|
1731
|
-
|
|
2182
|
+
_context2.next = 6;
|
|
1732
2183
|
return this.run(_tests);
|
|
1733
2184
|
case 6:
|
|
1734
|
-
result =
|
|
2185
|
+
result = _context2.sent;
|
|
1735
2186
|
this.report(detailed || result.failed > 0);
|
|
1736
|
-
return
|
|
2187
|
+
return _context2.abrupt("return", {
|
|
1737
2188
|
runner: this,
|
|
1738
2189
|
result: result
|
|
1739
2190
|
});
|
|
1740
2191
|
case 9:
|
|
1741
2192
|
case "end":
|
|
1742
|
-
return
|
|
2193
|
+
return _context2.stop();
|
|
1743
2194
|
}
|
|
1744
|
-
},
|
|
2195
|
+
}, _callee2, this);
|
|
1745
2196
|
}));
|
|
1746
2197
|
function test() {
|
|
1747
2198
|
return _test2.apply(this, arguments);
|
|
@@ -1756,4 +2207,8 @@ var TestRunner = /*#__PURE__*/function () {
|
|
|
1756
2207
|
}
|
|
1757
2208
|
}]);
|
|
1758
2209
|
}();
|
|
1759
|
-
|
|
2210
|
+
|
|
2211
|
+
exports.Expect = Expect;
|
|
2212
|
+
exports.Test = Test;
|
|
2213
|
+
exports.TestException = TestException;
|
|
2214
|
+
exports.TestRunner = TestRunner;
|