@augment-vir/assert 31.67.0 → 31.68.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.
|
@@ -36,7 +36,7 @@ function recursiveCheckJsonEquals(actual, expected) {
|
|
|
36
36
|
if (actual === expected || baseJsonEquals(actual, expected)) {
|
|
37
37
|
return true;
|
|
38
38
|
}
|
|
39
|
-
if (actual != null &&
|
|
39
|
+
else if (actual != null &&
|
|
40
40
|
expected != null &&
|
|
41
41
|
typeof actual === 'object' &&
|
|
42
42
|
typeof expected === 'object') {
|
|
@@ -24,7 +24,10 @@ const assertions = {
|
|
|
24
24
|
*/
|
|
25
25
|
isInBounds(actual, { max, min }, failureMessage) {
|
|
26
26
|
if (actual < min || max < actual) {
|
|
27
|
-
throw new AssertionError(`${actual} is not within the bounds ${stringify({
|
|
27
|
+
throw new AssertionError(`${actual} is not within the bounds ${stringify({
|
|
28
|
+
min,
|
|
29
|
+
max,
|
|
30
|
+
})}`, failureMessage);
|
|
28
31
|
}
|
|
29
32
|
},
|
|
30
33
|
/**
|
|
@@ -49,7 +52,10 @@ const assertions = {
|
|
|
49
52
|
*/
|
|
50
53
|
isOutBounds(actual, { min, max }, failureMessage) {
|
|
51
54
|
if (min <= actual && actual <= max) {
|
|
52
|
-
throw new AssertionError(`${actual} is not outside the bounds ${stringify({
|
|
55
|
+
throw new AssertionError(`${actual} is not outside the bounds ${stringify({
|
|
56
|
+
min,
|
|
57
|
+
max,
|
|
58
|
+
})}`, failureMessage);
|
|
53
59
|
}
|
|
54
60
|
},
|
|
55
61
|
/**
|
|
@@ -650,7 +656,10 @@ export const numericGuards = {
|
|
|
650
656
|
*/
|
|
651
657
|
isInBounds(actual, { max, min }, failureMessage) {
|
|
652
658
|
if (actual < min || max < actual) {
|
|
653
|
-
throw new AssertionError(`${actual} is not within the bounds ${stringify({
|
|
659
|
+
throw new AssertionError(`${actual} is not within the bounds ${stringify({
|
|
660
|
+
min,
|
|
661
|
+
max,
|
|
662
|
+
})}`, failureMessage);
|
|
654
663
|
}
|
|
655
664
|
return actual;
|
|
656
665
|
},
|
|
@@ -677,7 +686,10 @@ export const numericGuards = {
|
|
|
677
686
|
*/
|
|
678
687
|
isOutBounds(actual, { min, max }, failureMessage) {
|
|
679
688
|
if (min <= actual && actual <= max) {
|
|
680
|
-
throw new AssertionError(`${actual} is not outside the bounds ${stringify({
|
|
689
|
+
throw new AssertionError(`${actual} is not outside the bounds ${stringify({
|
|
690
|
+
min,
|
|
691
|
+
max,
|
|
692
|
+
})}`, failureMessage);
|
|
681
693
|
}
|
|
682
694
|
return actual;
|
|
683
695
|
},
|
|
@@ -130,8 +130,12 @@ export async function waitUntilOutput(functionToCallOrAsserter, inputsOrFunction
|
|
|
130
130
|
const failureMessage = usingCustomAsserter
|
|
131
131
|
? emptyOrFailureMessage
|
|
132
132
|
: emptyOrFailureMessageOrOptions;
|
|
133
|
-
const timeout = convertDuration(options.timeout, {
|
|
134
|
-
|
|
133
|
+
const timeout = convertDuration(options.timeout, {
|
|
134
|
+
milliseconds: true,
|
|
135
|
+
}).milliseconds;
|
|
136
|
+
const interval = convertDuration(options.interval, {
|
|
137
|
+
milliseconds: true,
|
|
138
|
+
});
|
|
135
139
|
let lastCallbackOutput = notSetSymbol;
|
|
136
140
|
let lastError = undefined;
|
|
137
141
|
async function checkCondition() {
|
|
@@ -550,7 +550,7 @@ export const valueGuards = {
|
|
|
550
550
|
if (typeof actual !== 'string' && typeof actual !== 'object') {
|
|
551
551
|
return false;
|
|
552
552
|
}
|
|
553
|
-
if (typeof actual === 'string') {
|
|
553
|
+
else if (typeof actual === 'string') {
|
|
554
554
|
return !actual;
|
|
555
555
|
}
|
|
556
556
|
else if (Array.isArray(actual)) {
|
|
@@ -591,7 +591,7 @@ export const valueGuards = {
|
|
|
591
591
|
if (typeof actual !== 'string' && typeof actual !== 'object') {
|
|
592
592
|
return true;
|
|
593
593
|
}
|
|
594
|
-
if (typeof actual === 'string') {
|
|
594
|
+
else if (typeof actual === 'string') {
|
|
595
595
|
return !!actual;
|
|
596
596
|
}
|
|
597
597
|
else if (Array.isArray(actual)) {
|
|
@@ -11,8 +11,12 @@ export const defaultWaitUntilOptions = {
|
|
|
11
11
|
const notSetSymbol = Symbol('not set');
|
|
12
12
|
export async function executeWaitUntil(assert, rawArgs, requireSynchronousResult) {
|
|
13
13
|
const { callback, extraAssertionArgs, failureMessage, options } = parseWaitUntilArgs(rawArgs);
|
|
14
|
-
const timeout = convertDuration(options.timeout, {
|
|
15
|
-
|
|
14
|
+
const timeout = convertDuration(options.timeout, {
|
|
15
|
+
milliseconds: true,
|
|
16
|
+
}).milliseconds;
|
|
17
|
+
const interval = convertDuration(options.interval, {
|
|
18
|
+
milliseconds: true,
|
|
19
|
+
});
|
|
16
20
|
let lastCallbackOutput = notSetSymbol;
|
|
17
21
|
let lastError = undefined;
|
|
18
22
|
async function checkCondition() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@augment-vir/assert",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.68.0",
|
|
4
4
|
"description": "A collection of assertions for test and production code alike.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"augment",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"test:update": "npm test"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@augment-vir/core": "^31.
|
|
46
|
-
"@date-vir/duration": "^8.
|
|
45
|
+
"@augment-vir/core": "^31.68.0",
|
|
46
|
+
"@date-vir/duration": "^8.2.0",
|
|
47
47
|
"deep-eql": "^5.0.2",
|
|
48
48
|
"expect-type": "^1.3.0",
|
|
49
49
|
"type-fest": "^5.4.4"
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@web/dev-server-esbuild": "^1.0.5",
|
|
54
54
|
"@web/test-runner": "^0.20.2",
|
|
55
55
|
"@web/test-runner-playwright": "^0.11.1",
|
|
56
|
-
"c8": "^
|
|
56
|
+
"c8": "^11.0.0",
|
|
57
57
|
"istanbul-smart-text-reporter": "^1.1.5",
|
|
58
58
|
"typescript": "^5.9.3"
|
|
59
59
|
},
|