assertron 10.0.1 → 11.0.0
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/cjs/assert-order/AssertOrder.js +99 -176
- package/cjs/assert-order/AssertOrder.js.map +1 -1
- package/cjs/assert-order/InvalidOrder.js +16 -34
- package/cjs/assert-order/InvalidOrder.js.map +1 -1
- package/cjs/assert-order/StateMachine.js +66 -122
- package/cjs/assert-order/StateMachine.js.map +1 -1
- package/cjs/assertron/assertron.js +12 -12
- package/cjs/assertron/assertron.js.map +1 -1
- package/cjs/assertron/falsy.js +2 -2
- package/cjs/assertron/falsy.js.map +1 -1
- package/cjs/assertron/pathEqual.js +3 -3
- package/cjs/assertron/pathEqual.js.map +1 -1
- package/cjs/assertron/rejects.js +3 -3
- package/cjs/assertron/rejects.js.map +1 -1
- package/cjs/assertron/repeat.js +4 -4
- package/cjs/assertron/repeat.js.map +1 -1
- package/cjs/assertron/resolves.js +3 -3
- package/cjs/assertron/resolves.js.map +1 -1
- package/cjs/assertron/satisfies.js +4 -4
- package/cjs/assertron/satisfies.js.map +1 -1
- package/cjs/assertron/throws.js +9 -9
- package/cjs/assertron/throws.js.map +1 -1
- package/cjs/assertron/truthy.js +2 -2
- package/cjs/assertron/truthy.js.map +1 -1
- package/cjs/errors.js +12 -32
- package/cjs/errors.js.map +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/utils/index.js +2 -2
- package/cjs/utils/index.js.map +1 -1
- package/cjs/utils/notEqualMessage.js +1 -1
- package/cjs/utils/notEqualMessage.js.map +1 -1
- package/cjs/utils/notSatisfiedMessage.js +6 -15
- package/cjs/utils/notSatisfiedMessage.js.map +1 -1
- package/cjs/utils/notThrownMessage.js +2 -2
- package/cjs/utils/notThrownMessage.js.map +1 -1
- package/cjs/utils/promiseMessages.js +5 -5
- package/cjs/utils/promiseMessages.js.map +1 -1
- package/cjs/utils/unexpectedErrorMessage.js +4 -4
- package/cjs/utils/unexpectedErrorMessage.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateMachine.js","sourceRoot":"","sources":["../../ts/assert-order/StateMachine.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"StateMachine.js","sourceRoot":"","sources":["../../ts/assert-order/StateMachine.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.assertron = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
const errors_js_1 = require("../errors.js");
|
|
5
|
+
const index_js_1 = require("../utils/index.js");
|
|
6
|
+
const falsy_js_1 = require("./falsy.js");
|
|
7
|
+
const pathEqual_js_1 = require("./pathEqual.js");
|
|
8
|
+
const rejects_js_1 = require("./rejects.js");
|
|
9
|
+
const repeat_js_1 = require("./repeat.js");
|
|
10
|
+
const resolves_js_1 = require("./resolves.js");
|
|
11
|
+
const satisfies_js_1 = require("./satisfies.js");
|
|
12
|
+
const throws_js_1 = require("./throws.js");
|
|
13
|
+
const truthy_js_1 = require("./truthy.js");
|
|
14
14
|
exports.assertron = {
|
|
15
|
-
false
|
|
15
|
+
false(value) {
|
|
16
16
|
if (value !== false)
|
|
17
17
|
throw new errors_js_1.AssertionError((0, index_js_1.notEqualMessage)(value, false), { ssf: exports.assertron.false });
|
|
18
18
|
},
|
|
@@ -23,7 +23,7 @@ exports.assertron = {
|
|
|
23
23
|
resolves: resolves_js_1.resolves,
|
|
24
24
|
satisfies: satisfies_js_1.satisfies,
|
|
25
25
|
throws: throws_js_1.throws,
|
|
26
|
-
true
|
|
26
|
+
true(value) {
|
|
27
27
|
if (value !== true)
|
|
28
28
|
throw new errors_js_1.AssertionError((0, index_js_1.notEqualMessage)(value, true), { ssf: exports.assertron.true });
|
|
29
29
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertron.js","sourceRoot":"","sources":["../../ts/assertron/assertron.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"assertron.js","sourceRoot":"","sources":["../../ts/assertron/assertron.ts"],"names":[],"mappings":";;;AAAA,4CAA6C;AAC7C,gDAAmD;AACnD,yCAAkC;AAClC,iDAA0C;AAC1C,6CAAsC;AACtC,2CAAoC;AACpC,+CAAwC;AACxC,iDAA0C;AAC1C,2CAAoC;AACpC,2CAAoC;AAEvB,QAAA,SAAS,GAAG;IACvB,KAAK,CAAC,KAAU;QACd,IAAI,KAAK,KAAK,KAAK;YACjB,MAAM,IAAI,0BAAc,CAAC,IAAA,0BAAe,EAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,iBAAS,CAAC,KAAK,EAAE,CAAC,CAAA;IACrF,CAAC;IACD,KAAK,EAAL,gBAAK;IACL,SAAS,EAAT,wBAAS;IACT,OAAO,EAAP,oBAAO;IACP,MAAM,EAAN,kBAAM;IACN,QAAQ,EAAR,sBAAQ;IACR,SAAS,EAAT,wBAAS;IACT,MAAM,EAAN,kBAAM;IACN,IAAI,CAAC,KAAU;QACb,IAAI,KAAK,KAAK,IAAI;YAChB,MAAM,IAAI,0BAAc,CAAC,IAAA,0BAAe,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,iBAAS,CAAC,IAAI,EAAE,CAAC,CAAA;IACnF,CAAC;IACD,MAAM,EAAN,kBAAM;CACP,CAAA"}
|
package/cjs/assertron/falsy.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.falsy = void 0;
|
|
4
|
-
|
|
4
|
+
const errors_js_1 = require("../errors.js");
|
|
5
5
|
function falsy(value) {
|
|
6
6
|
if (value)
|
|
7
|
-
throw new errors_js_1.AssertionError(
|
|
7
|
+
throw new errors_js_1.AssertionError(`Expected value to be falsy, but received ${value}`, { ssf: falsy });
|
|
8
8
|
}
|
|
9
9
|
exports.falsy = falsy;
|
|
10
10
|
//# sourceMappingURL=falsy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"falsy.js","sourceRoot":"","sources":["../../ts/assertron/falsy.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"falsy.js","sourceRoot":"","sources":["../../ts/assertron/falsy.ts"],"names":[],"mappings":";;;AAAA,4CAA6C;AAE7C,SAAgB,KAAK,CAAC,KAAU;IAC9B,IAAI,KAAK;QACP,MAAM,IAAI,0BAAc,CAAC,4CAA4C,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAA;AACjG,CAAC;AAHD,sBAGC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.pathEqual = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const path_equal_1 = require("path-equal");
|
|
5
|
+
const errors_js_1 = require("../errors.js");
|
|
6
|
+
const index_js_1 = require("../utils/index.js");
|
|
7
7
|
function pathEqual(actual, expected) {
|
|
8
8
|
if (!(0, path_equal_1.pathEqual)(actual, expected))
|
|
9
9
|
throw new errors_js_1.AssertionError((0, index_js_1.notEqualMessage)(actual, expected), { ssf: pathEqual });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pathEqual.js","sourceRoot":"","sources":["../../ts/assertron/pathEqual.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"pathEqual.js","sourceRoot":"","sources":["../../ts/assertron/pathEqual.ts"],"names":[],"mappings":";;;AAAA,2CAAqD;AACrD,4CAA6C;AAC7C,gDAAmD;AAEnD,SAAgB,SAAS,CAAC,MAAc,EAAE,QAAgB;IACxD,IAAI,CAAC,IAAA,sBAAW,EAAC,MAAM,EAAE,QAAQ,CAAC;QAChC,MAAM,IAAI,0BAAc,CAAC,IAAA,0BAAe,EAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAA;AACnF,CAAC;AAHD,8BAGC"}
|
package/cjs/assertron/rejects.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rejects = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const errors_js_1 = require("../errors.js");
|
|
5
|
+
const index_js_1 = require("../utils/index.js");
|
|
6
6
|
function rejects(promise) {
|
|
7
|
-
return promise.then(
|
|
7
|
+
return promise.then(value => { throw new errors_js_1.AssertionError((0, index_js_1.notRejectedMessage)(value), { ssf: rejects }); }, err => err);
|
|
8
8
|
}
|
|
9
9
|
exports.rejects = rejects;
|
|
10
10
|
//# sourceMappingURL=rejects.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rejects.js","sourceRoot":"","sources":["../../ts/assertron/rejects.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"rejects.js","sourceRoot":"","sources":["../../ts/assertron/rejects.ts"],"names":[],"mappings":";;;AAAA,4CAA6C;AAC7C,gDAAsD;AAEtD,SAAgB,OAAO,CAAU,OAAqB;IACpD,OAAO,OAAO,CAAC,IAAI,CACjB,KAAK,CAAC,EAAE,GAAG,MAAM,IAAI,0BAAc,CAAC,IAAA,6BAAkB,EAAC,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAA,CAAC,CAAC,EAClF,GAAG,CAAC,EAAE,CAAC,GAAG,CACX,CAAA;AACH,CAAC;AALD,0BAKC"}
|
package/cjs/assertron/repeat.js
CHANGED
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.repeat = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const is_promise_1 = __importDefault(require("is-promise"));
|
|
8
|
+
const errors_js_1 = require("../errors.js");
|
|
9
9
|
/**
|
|
10
10
|
* Repeat the specified function n times and return the last result.
|
|
11
11
|
* If the result is a promise, it will run the function sequentially.
|
|
@@ -16,11 +16,11 @@ function repeat(fn, times) {
|
|
|
16
16
|
exports.repeat = repeat;
|
|
17
17
|
function repeatRecur(fn, i, times) {
|
|
18
18
|
try {
|
|
19
|
-
|
|
19
|
+
const result = fn();
|
|
20
20
|
if (i === times)
|
|
21
21
|
return result;
|
|
22
22
|
if ((0, is_promise_1.default)(result)) {
|
|
23
|
-
return result.then(
|
|
23
|
+
return result.then(() => repeatRecur(fn, i + 1, times), (e) => { throw new errors_js_1.FailOnOccurrence(i, e, { ssf: repeat }); });
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
26
|
return repeatRecur(fn, i + 1, times);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repeat.js","sourceRoot":"","sources":["../../ts/assertron/repeat.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"repeat.js","sourceRoot":"","sources":["../../ts/assertron/repeat.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAkC;AAClC,4CAA+C;AAE/C;;;GAGG;AACH,SAAgB,MAAM,CAAI,EAAgC,EAAE,KAAa;IACvE,OAAO,WAAW,CAAC,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAA;AAClC,CAAC;AAFD,wBAEC;AAED,SAAS,WAAW,CAAI,EAAgC,EAAE,CAAS,EAAE,KAAa;IAChF,IAAI;QACF,MAAM,MAAM,GAAG,EAAE,EAAE,CAAA;QACnB,IAAI,CAAC,KAAK,KAAK;YAAE,OAAO,MAAa,CAAA;QAErC,IAAI,IAAA,oBAAS,EAAC,MAAM,CAAC,EAAE;YACrB,OAAO,MAAM,CAAC,IAAI,CAChB,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,EACnC,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,IAAI,4BAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAA,CAAC,CAAC,CACtD,CAAA;SACT;aACI;YACH,OAAO,WAAW,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAA;SACrC;KACF;IACD,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,YAAY,4BAAgB;YAAE,MAAM,CAAC,CAAA;QAC1C,MAAM,IAAI,4BAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAA;KAClD;AACH,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolves = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const errors_js_1 = require("../errors.js");
|
|
5
|
+
const index_js_1 = require("../utils/index.js");
|
|
6
6
|
function resolves(promise) {
|
|
7
|
-
return promise.then(
|
|
7
|
+
return promise.then(() => { }, error => { throw new errors_js_1.AssertionError((0, index_js_1.notResolvedMessage)(error), { ssf: resolves }); });
|
|
8
8
|
}
|
|
9
9
|
exports.resolves = resolves;
|
|
10
10
|
//# sourceMappingURL=resolves.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolves.js","sourceRoot":"","sources":["../../ts/assertron/resolves.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"resolves.js","sourceRoot":"","sources":["../../ts/assertron/resolves.ts"],"names":[],"mappings":";;;AAAA,4CAA6C;AAC7C,gDAAsD;AAEtD,SAAgB,QAAQ,CAAC,OAAqB;IAC5C,OAAO,OAAO,CAAC,IAAI,CACjB,GAAG,EAAE,GAAG,CAAC,EACT,KAAK,CAAC,EAAE,GAAG,MAAM,IAAI,0BAAc,CAAC,IAAA,6BAAkB,EAAC,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAA,CAAC,CAAC,CACpF,CAAA;AACH,CAAC;AALD,4BAKC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.satisfies = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const satisfier_1 = require("satisfier");
|
|
5
|
+
const errors_js_1 = require("../errors.js");
|
|
6
|
+
const index_js_1 = require("../utils/index.js");
|
|
7
7
|
/**
|
|
8
8
|
* Check if `actual` satisfies criteria in `expected`.
|
|
9
9
|
* @param expected All properties can be a value which will be compared to the same property in `actual`, RegExp, or a predicate function that will be used to check against the property.
|
|
10
10
|
*/
|
|
11
11
|
function satisfies(actual, expected) {
|
|
12
|
-
|
|
12
|
+
const diff = (0, satisfier_1.createSatisfier)(expected).exec(actual);
|
|
13
13
|
if (diff) {
|
|
14
14
|
throw new errors_js_1.AssertionError((0, index_js_1.notSatisfiedMessage)(diff), { ssf: satisfies });
|
|
15
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"satisfies.js","sourceRoot":"","sources":["../../ts/assertron/satisfies.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"satisfies.js","sourceRoot":"","sources":["../../ts/assertron/satisfies.ts"],"names":[],"mappings":";;;AAAA,yCAA2C;AAE3C,4CAA6C;AAC7C,gDAAuD;AAkBvD;;;GAGG;AACH,SAAgB,SAAS,CAAkC,MAAc,EAAE,QAAsC;IAC/G,MAAM,IAAI,GAAG,IAAA,2BAAe,EAAC,QAAe,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC1D,IAAI,IAAI,EAAE;QACR,MAAM,IAAI,0BAAc,CAAC,IAAA,8BAAmB,EAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAA;KACxE;AACH,CAAC;AALD,8BAKC"}
|
package/cjs/assertron/throws.js
CHANGED
|
@@ -4,15 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.throws = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const is_promise_1 = __importDefault(require("is-promise"));
|
|
8
|
+
const errors_js_1 = require("../errors.js");
|
|
9
|
+
const index_js_1 = require("../utils/index.js");
|
|
10
10
|
function throws(value, validator) {
|
|
11
11
|
if (typeof value !== 'function' && !(0, is_promise_1.default)(value)) {
|
|
12
12
|
throw new errors_js_1.AssertionError('`assertron.throws()` must be called with a function or promise.', { ssf: throws });
|
|
13
13
|
}
|
|
14
14
|
if (!(0, is_promise_1.default)(value)) {
|
|
15
|
-
|
|
15
|
+
const { threw, err, result } = tryCatch(value);
|
|
16
16
|
if (threw) {
|
|
17
17
|
if (failValidation(validator, err)) {
|
|
18
18
|
throw new errors_js_1.AssertionError((0, index_js_1.unexpectedErrorMessage)(err, validator), { ssf: throws });
|
|
@@ -22,7 +22,7 @@ function throws(value, validator) {
|
|
|
22
22
|
value = result;
|
|
23
23
|
}
|
|
24
24
|
if ((0, is_promise_1.default)(value)) {
|
|
25
|
-
return value.then(
|
|
25
|
+
return value.then(value => { throw new errors_js_1.AssertionError((0, index_js_1.notRejectedMessage)(value), { ssf: throws }); }, err => {
|
|
26
26
|
if (failValidation(validator, err)) {
|
|
27
27
|
throw new errors_js_1.AssertionError((0, index_js_1.unexpectedErrorMessage)(err, validator), { ssf: throws });
|
|
28
28
|
}
|
|
@@ -33,9 +33,9 @@ function throws(value, validator) {
|
|
|
33
33
|
}
|
|
34
34
|
exports.throws = throws;
|
|
35
35
|
function tryCatch(fn) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
let result;
|
|
37
|
+
let err;
|
|
38
|
+
let threw = false;
|
|
39
39
|
try {
|
|
40
40
|
result = fn();
|
|
41
41
|
}
|
|
@@ -43,7 +43,7 @@ function tryCatch(fn) {
|
|
|
43
43
|
err = e;
|
|
44
44
|
threw = true;
|
|
45
45
|
}
|
|
46
|
-
return { threw
|
|
46
|
+
return { threw, err, result };
|
|
47
47
|
}
|
|
48
48
|
function failValidation(validator, error) {
|
|
49
49
|
if (!validator)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throws.js","sourceRoot":"","sources":["../../ts/assertron/throws.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"throws.js","sourceRoot":"","sources":["../../ts/assertron/throws.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAkC;AAClC,4CAA6C;AAE7C,gDAAoH;AAMpH,SAAgB,MAAM,CAAC,KAAwD,EAAE,SAAkD;IACjI,IAAI,OAAO,KAAK,KAAK,UAAU,IAAI,CAAC,IAAA,oBAAS,EAAC,KAAK,CAAC,EAAE;QACpD,MAAM,IAAI,0BAAc,CACtB,iEAAiE,EACjE,EAAE,GAAG,EAAE,MAAM,EAAE,CAChB,CAAA;KACF;IAED,IAAI,CAAC,IAAA,oBAAS,EAAC,KAAK,CAAC,EAAE;QACrB,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;QAC9C,IAAI,KAAK,EAAE;YACT,IAAI,cAAc,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE;gBAClC,MAAM,IAAI,0BAAc,CAAC,IAAA,iCAAsB,EAAC,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAA;aAClF;YACD,OAAO,GAAG,CAAA;SACX;QACD,KAAK,GAAG,MAAM,CAAA;KACf;IAED,IAAI,IAAA,oBAAS,EAAC,KAAK,CAAC,EAAE;QACpB,OAAO,KAAK,CAAC,IAAI,CACf,KAAK,CAAC,EAAE,GAAG,MAAM,IAAI,0BAAc,CAAC,IAAA,6BAAkB,EAAC,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAA,CAAC,CAAC,EACjF,GAAG,CAAC,EAAE;YACJ,IAAI,cAAc,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE;gBAClC,MAAM,IAAI,0BAAc,CAAC,IAAA,iCAAsB,EAAC,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAA;aAClF;YACD,OAAO,GAAG,CAAA;QACZ,CAAC,CACF,CAAA;KACF;IAED,MAAM,IAAI,0BAAc,CAAC,IAAA,2BAAgB,EAAC,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAA;AACpE,CAAC;AAhCD,wBAgCC;AAED,SAAS,QAAQ,CAAC,EAAa;IAC7B,IAAI,MAAM,CAAA;IACV,IAAI,GAAG,CAAA;IACP,IAAI,KAAK,GAAG,KAAK,CAAA;IACjB,IAAI;QACF,MAAM,GAAG,EAAE,EAAE,CAAA;KACd;IACD,OAAO,CAAC,EAAE;QACR,GAAG,GAAG,CAAC,CAAA;QACP,KAAK,GAAG,IAAI,CAAA;KACb;IACD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,CAAA;AAC/B,CAAC;AACD,SAAS,cAAc,CAAC,SAA6D,EAAE,KAAU;IAC/F,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAA;IAE5B,IAAI,IAAA,6BAAkB,EAAC,SAAS,CAAC,EAAE;QACjC,OAAO,CAAC,CAAC,KAAK,YAAY,SAAS,CAAC,CAAA;KACrC;SACI;QACH,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;KACzB;AACH,CAAC"}
|
package/cjs/assertron/truthy.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.truthy = void 0;
|
|
4
|
-
|
|
4
|
+
const errors_js_1 = require("../errors.js");
|
|
5
5
|
function truthy(value) {
|
|
6
6
|
if (!value)
|
|
7
|
-
throw new errors_js_1.AssertionError(
|
|
7
|
+
throw new errors_js_1.AssertionError(`Expected value to be truthy, but received ${value}`, { ssf: truthy });
|
|
8
8
|
}
|
|
9
9
|
exports.truthy = truthy;
|
|
10
10
|
//# sourceMappingURL=truthy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"truthy.js","sourceRoot":"","sources":["../../ts/assertron/truthy.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"truthy.js","sourceRoot":"","sources":["../../ts/assertron/truthy.ts"],"names":[],"mappings":";;;AAAA,4CAA6C;AAE7C,SAAgB,MAAM,CAAC,KAAU;IAC/B,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,0BAAc,CAClC,6CAA6C,KAAK,EAAE,EACpD,EAAE,GAAG,EAAE,MAAM,EAAE,CAChB,CAAA;AACH,CAAC;AALD,wBAKC"}
|
package/cjs/errors.js
CHANGED
|
@@ -1,53 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.FailOnOccurrence = exports.AssertionError = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
const iso_error_1 = require("iso-error");
|
|
5
|
+
const index_js_1 = require("./utils/index.js");
|
|
21
6
|
/**
|
|
22
7
|
* A base error for all assertion errors
|
|
23
8
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return _super.call(this, 'assertron', message, options) || this;
|
|
9
|
+
class AssertionError extends iso_error_1.ModuleError {
|
|
10
|
+
constructor(message, options) {
|
|
11
|
+
super('assertron', message, options);
|
|
28
12
|
}
|
|
29
|
-
|
|
30
|
-
}(iso_error_1.ModuleError));
|
|
13
|
+
}
|
|
31
14
|
exports.AssertionError = AssertionError;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Object.defineProperty(_this, "occurrence", {
|
|
15
|
+
class FailOnOccurrence extends AssertionError {
|
|
16
|
+
constructor(occurrence, error, options) {
|
|
17
|
+
super((0, index_js_1.failOnOccurrence)(occurrence, error), options);
|
|
18
|
+
Object.defineProperty(this, "occurrence", {
|
|
37
19
|
enumerable: true,
|
|
38
20
|
configurable: true,
|
|
39
21
|
writable: true,
|
|
40
22
|
value: occurrence
|
|
41
23
|
});
|
|
42
|
-
Object.defineProperty(
|
|
24
|
+
Object.defineProperty(this, "error", {
|
|
43
25
|
enumerable: true,
|
|
44
26
|
configurable: true,
|
|
45
27
|
writable: true,
|
|
46
28
|
value: error
|
|
47
29
|
});
|
|
48
|
-
return _this;
|
|
49
30
|
}
|
|
50
|
-
|
|
51
|
-
}(AssertionError));
|
|
31
|
+
}
|
|
52
32
|
exports.FailOnOccurrence = FailOnOccurrence;
|
|
53
33
|
//# sourceMappingURL=errors.js.map
|
package/cjs/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../ts/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../ts/errors.ts"],"names":[],"mappings":";;;AAAA,yCAAiD;AAEjD,+CAAmD;AAEnD;;GAEG;AACH,MAAa,cAAe,SAAQ,uBAAW;IAC7C,YAAY,OAAe,EAAE,OAA+B;QAC1D,KAAK,CAAC,WAAW,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IACtC,CAAC;CACF;AAJD,wCAIC;AAMD,MAAa,gBAAiB,SAAQ,cAAc;IAClD,YAAmB,UAAkB,EAAS,KAAU,EAAE,OAA+B;QACvF,KAAK,CAAC,IAAA,2BAAgB,EAAC,UAAU,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC,CAAA;;;;;mBADlC;;;;;;mBAA2B;;IAE9C,CAAC;CACF;AAJD,4CAIC"}
|
package/cjs/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.a = void 0;
|
|
18
|
-
|
|
18
|
+
const index_js_1 = require("./assertron/index.js");
|
|
19
19
|
Object.defineProperty(exports, "a", { enumerable: true, get: function () { return index_js_1.assertron; } });
|
|
20
20
|
__exportStar(require("./assert-order/index.js"), exports);
|
|
21
21
|
__exportStar(require("./assertron/index.js"), exports);
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mDAAgD;AAM1B,kFANb,oBAAS,OAMK;AAJvB,0DAAuC;AACvC,uDAAoC;AACpC,8CAA2B;AAC3B,kBAAe,oBAAS,CAAA"}
|
package/cjs/utils/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.failOnOccurrence = void 0;
|
|
18
|
-
|
|
18
|
+
const tersify_1 = require("tersify");
|
|
19
19
|
__exportStar(require("./isErrorConstructor.js"), exports);
|
|
20
20
|
__exportStar(require("./notEqualMessage.js"), exports);
|
|
21
21
|
__exportStar(require("./notSatisfiedMessage.js"), exports);
|
|
@@ -23,7 +23,7 @@ __exportStar(require("./notThrownMessage.js"), exports);
|
|
|
23
23
|
__exportStar(require("./promiseMessages.js"), exports);
|
|
24
24
|
__exportStar(require("./unexpectedErrorMessage.js"), exports);
|
|
25
25
|
function failOnOccurrence(occurrence, error) {
|
|
26
|
-
return
|
|
26
|
+
return `Failed on ${occurrence} occurrence: ${(0, tersify_1.tersify)(error, { maxLength: Infinity })}`;
|
|
27
27
|
}
|
|
28
28
|
exports.failOnOccurrence = failOnOccurrence;
|
|
29
29
|
//# sourceMappingURL=index.js.map
|
package/cjs/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAAiC;AAEjC,0DAAuC;AACvC,uDAAoC;AACpC,2DAAwC;AACxC,wDAAqC;AACrC,uDAAoC;AACpC,8DAA2C;AAE3C,SAAgB,gBAAgB,CAAC,UAAkB,EAAE,KAAU;IAC7D,OAAO,aAAa,UAAU,gBAAgB,IAAA,iBAAO,EAAC,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAA;AACzF,CAAC;AAFD,4CAEC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.notEqualMessage = void 0;
|
|
4
4
|
function notEqualMessage(actual, expected) {
|
|
5
|
-
return
|
|
5
|
+
return `Expected value to equal ${expected}, but received ${actual}`;
|
|
6
6
|
}
|
|
7
7
|
exports.notEqualMessage = notEqualMessage;
|
|
8
8
|
//# sourceMappingURL=notEqualMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notEqualMessage.js","sourceRoot":"","sources":["../../ts/utils/notEqualMessage.ts"],"names":[],"mappings":";;;AAAA,SAAgB,eAAe,CAAC,MAAW,EAAE,QAAa;IACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"notEqualMessage.js","sourceRoot":"","sources":["../../ts/utils/notEqualMessage.ts"],"names":[],"mappings":";;;AAAA,SAAgB,eAAe,CAAC,MAAW,EAAE,QAAa;IACxD,OAAO,2BAA2B,QAAQ,kBAAkB,MAAM,EAAE,CAAA;AACtE,CAAC;AAFD,0CAEC"}
|
|
@@ -1,31 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
-
if (ar || !(i in from)) {
|
|
5
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
-
ar[i] = from[i];
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.notSatisfiedMessage = void 0;
|
|
13
|
-
|
|
4
|
+
const tersify_1 = require("tersify");
|
|
14
5
|
function notSatisfiedMessage(entries) {
|
|
15
|
-
return entries.map(
|
|
16
|
-
|
|
17
|
-
return
|
|
6
|
+
return entries.map(e => {
|
|
7
|
+
const path = formatPath(e.path);
|
|
8
|
+
return `Expect ${path} to satisfy ${formatValue(e.expected)}, but received ${formatValue(e.actual)}`;
|
|
18
9
|
}).join('\n');
|
|
19
10
|
}
|
|
20
11
|
exports.notSatisfiedMessage = notSatisfiedMessage;
|
|
21
12
|
function formatPath(entries) {
|
|
22
13
|
if (entries.length === 0)
|
|
23
14
|
return 'actual';
|
|
24
|
-
|
|
15
|
+
const nodes = [...entries];
|
|
25
16
|
if (isIndice(nodes[0])) {
|
|
26
17
|
nodes.unshift('actual');
|
|
27
18
|
}
|
|
28
|
-
return nodes.map(
|
|
19
|
+
return nodes.map(n => isIndice(n) ? `[${n}]` : '.' + n).join('').slice(1);
|
|
29
20
|
}
|
|
30
21
|
function isIndice(node) {
|
|
31
22
|
return typeof node === 'number';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notSatisfiedMessage.js","sourceRoot":"","sources":["../../ts/utils/notSatisfiedMessage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notSatisfiedMessage.js","sourceRoot":"","sources":["../../ts/utils/notSatisfiedMessage.ts"],"names":[],"mappings":";;;AACA,qCAAiC;AAEjC,SAAgB,mBAAmB,CAAC,OAAe;IACjD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QACrB,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;QAC/B,OAAO,UAAU,IAAI,eAAe,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,kBAAkB,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAA;IACtG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACf,CAAC;AALD,kDAKC;AAED,SAAS,UAAU,CAAC,OAA4B;IAC9C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QACtB,OAAO,QAAQ,CAAA;IACjB,MAAM,KAAK,GAAG,CAAC,GAAG,OAAO,CAAC,CAAA;IAC1B,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;QACtB,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;KACxB;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAC3E,CAAC;AAED,SAAS,QAAQ,CAAC,IAAqB;IACrC,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAA;AACjC,CAAC;AAED,SAAS,WAAW,CAAC,KAAU;IAC7B,OAAO,IAAA,iBAAO,EAAC,KAAK,CAAC,CAAA;AACvB,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.notThrownMessage = void 0;
|
|
4
|
-
|
|
4
|
+
const tersify_1 = require("tersify");
|
|
5
5
|
function notThrownMessage(value) {
|
|
6
|
-
return
|
|
6
|
+
return `Expect function to throw, but it returned '${(0, tersify_1.tersify)(value)}' instead.`;
|
|
7
7
|
}
|
|
8
8
|
exports.notThrownMessage = notThrownMessage;
|
|
9
9
|
//# sourceMappingURL=notThrownMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notThrownMessage.js","sourceRoot":"","sources":["../../ts/utils/notThrownMessage.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"notThrownMessage.js","sourceRoot":"","sources":["../../ts/utils/notThrownMessage.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AAEjC,SAAgB,gBAAgB,CAAC,KAAU;IACzC,OAAO,8CAA8C,IAAA,iBAAO,EAAC,KAAK,CAAC,YAAY,CAAA;AACjF,CAAC;AAFD,4CAEC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.notResolvedMessage = exports.notRejectedMessage = void 0;
|
|
4
|
-
|
|
4
|
+
const tersify_1 = require("tersify");
|
|
5
5
|
function notRejectedMessage(value) {
|
|
6
|
-
return
|
|
7
|
-
?
|
|
6
|
+
return `Expected promise to reject, but it resolves with ` + (typeof value === 'string'
|
|
7
|
+
? `'${value}'` : (0, tersify_1.tersify)(value, { maxLength: Infinity }));
|
|
8
8
|
}
|
|
9
9
|
exports.notRejectedMessage = notRejectedMessage;
|
|
10
10
|
function notResolvedMessage(error) {
|
|
11
|
-
return
|
|
12
|
-
?
|
|
11
|
+
return `Expected promise to resolve, but it rejects with ` + (typeof error === 'string'
|
|
12
|
+
? `'${error}'` : error instanceof Error ? error : (0, tersify_1.tersify)(error, { maxLength: Infinity }));
|
|
13
13
|
}
|
|
14
14
|
exports.notResolvedMessage = notResolvedMessage;
|
|
15
15
|
//# sourceMappingURL=promiseMessages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promiseMessages.js","sourceRoot":"","sources":["../../ts/utils/promiseMessages.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"promiseMessages.js","sourceRoot":"","sources":["../../ts/utils/promiseMessages.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AAEjC,SAAgB,kBAAkB,CAAC,KAAU;IAC3C,OAAO,mDAAmD,GAAG,CAAC,OAAO,KAAK,KAAK,QAAQ;QACrF,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,IAAA,iBAAO,EAAC,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAA;AAC7D,CAAC;AAHD,gDAGC;AAED,SAAgB,kBAAkB,CAAC,KAAU;IAC3C,OAAO,mDAAmD,GAAG,CAAC,OAAO,KAAK,KAAK,QAAQ;QACrF,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAA,iBAAO,EAAC,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAA;AAC9F,CAAC;AAHD,gDAGC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.unexpectedErrorMessage = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const tersify_1 = require("tersify");
|
|
5
|
+
const isErrorConstructor_js_1 = require("./isErrorConstructor.js");
|
|
6
6
|
function unexpectedErrorMessage(actual, expected) {
|
|
7
|
-
return
|
|
8
|
-
expected.name : (0, tersify_1.tersify)(expected)
|
|
7
|
+
return `Unexpected error. Expecting '${(0, isErrorConstructor_js_1.isErrorConstructor)(expected) ?
|
|
8
|
+
expected.name : (0, tersify_1.tersify)(expected)}' but received ${(0, tersify_1.tersify)(actual)}`;
|
|
9
9
|
}
|
|
10
10
|
exports.unexpectedErrorMessage = unexpectedErrorMessage;
|
|
11
11
|
//# sourceMappingURL=unexpectedErrorMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unexpectedErrorMessage.js","sourceRoot":"","sources":["../../ts/utils/unexpectedErrorMessage.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"unexpectedErrorMessage.js","sourceRoot":"","sources":["../../ts/utils/unexpectedErrorMessage.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AAEjC,mEAA4D;AAE5D,SAAgB,sBAAsB,CAAC,MAAW,EAAE,QAAgD;IAClG,OAAO,gCAAgC,IAAA,0CAAkB,EAAC,QAAQ,CAAC,CAAC,CAAC;QACnE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,iBAAO,EAAC,QAAQ,CAAC,kBAAkB,IAAA,iBAAO,EAAC,MAAM,CAAC,EAAE,CAAA;AACxE,CAAC;AAHD,wDAGC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assertron",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0",
|
|
4
4
|
"description": "A supplementary assertion library",
|
|
5
5
|
"homepage": "https://github.com/unional/assertron",
|
|
6
6
|
"bugs": {
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"tslib": "^2.4.0",
|
|
95
95
|
"typescript": "^4.7.3"
|
|
96
96
|
},
|
|
97
|
-
"packageManager": "yarn@3.
|
|
97
|
+
"packageManager": "yarn@3.3.0",
|
|
98
98
|
"size-limit": [
|
|
99
99
|
{
|
|
100
100
|
"path": "./cjs/index.js",
|