assertron 11.5.2 → 11.5.4
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 +7 -7
- package/cjs/_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/defineProperty.js +12 -0
- package/cjs/_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/toPrimitive.js +14 -0
- package/cjs/_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/toPropertyKey.js +9 -0
- package/cjs/_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/typeof.js +16 -0
- package/cjs/_virtual/_rolldown/runtime.js +23 -0
- package/cjs/assert-order/AssertOrder.d.ts +42 -39
- package/cjs/assert-order/AssertOrder.d.ts.map +1 -1
- package/cjs/assert-order/AssertOrder.js +118 -146
- package/cjs/assert-order/AssertOrder.js.map +1 -1
- package/cjs/assert-order/InvalidOrder.d.ts +10 -7
- package/cjs/assert-order/InvalidOrder.d.ts.map +1 -1
- package/cjs/assert-order/InvalidOrder.js +24 -43
- package/cjs/assert-order/InvalidOrder.js.map +1 -1
- package/cjs/assert-order/StateMachine.js +101 -156
- package/cjs/assert-order/StateMachine.js.map +1 -1
- package/cjs/assert-order/index.d.ts +4 -4
- package/cjs/assert-order/types.d.ts +9 -6
- package/cjs/assert-order/types.d.ts.map +1 -1
- package/cjs/assertron/assertron.d.ts +23 -20
- package/cjs/assertron/assertron.d.ts.map +1 -1
- package/cjs/assertron/assertron.js +36 -39
- package/cjs/assertron/assertron.js.map +1 -1
- package/cjs/assertron/falsy.js +5 -6
- package/cjs/assertron/falsy.js.map +1 -1
- package/cjs/assertron/index.d.ts +3 -3
- package/cjs/assertron/isInstanceof.js +6 -7
- package/cjs/assertron/isInstanceof.js.map +1 -1
- package/cjs/assertron/pathEqual.js +7 -8
- package/cjs/assertron/pathEqual.js.map +1 -1
- package/cjs/assertron/rejects.js +8 -8
- package/cjs/assertron/rejects.js.map +1 -1
- package/cjs/assertron/repeat.js +23 -31
- package/cjs/assertron/repeat.js.map +1 -1
- package/cjs/assertron/resolves.js +8 -8
- package/cjs/assertron/resolves.js.map +1 -1
- package/cjs/assertron/satisfies.d.ts +5 -10
- package/cjs/assertron/satisfies.d.ts.map +1 -1
- package/cjs/assertron/satisfies.js +12 -14
- package/cjs/assertron/satisfies.js.map +1 -1
- package/cjs/assertron/throws.js +48 -55
- package/cjs/assertron/throws.js.map +1 -1
- package/cjs/assertron/truthy.js +5 -6
- package/cjs/assertron/truthy.js.map +1 -1
- package/cjs/errors.d.ts +13 -10
- package/cjs/errors.d.ts.map +1 -1
- package/cjs/errors.js +19 -29
- package/cjs/errors.js.map +1 -1
- package/cjs/index.d.ts +10 -8
- package/cjs/index.js +98 -37
- package/cjs/index.js.map +1 -1
- package/cjs/package.json +3 -1
- package/cjs/types.d.ts +5 -2
- package/cjs/types.d.ts.map +1 -1
- package/cjs/utils/index.js +18 -25
- package/cjs/utils/index.js.map +1 -1
- package/cjs/utils/isErrorConstructor.js +4 -4
- package/cjs/utils/isErrorConstructor.js.map +1 -1
- package/cjs/utils/notEqualMessage.js +4 -4
- package/cjs/utils/notEqualMessage.js.map +1 -1
- package/cjs/utils/notSatisfiedMessage.js +14 -23
- package/cjs/utils/notSatisfiedMessage.js.map +1 -1
- package/cjs/utils/notThrownMessage.js +5 -5
- package/cjs/utils/notThrownMessage.js.map +1 -1
- package/cjs/utils/promiseMessages.js +7 -13
- package/cjs/utils/promiseMessages.js.map +1 -1
- package/cjs/utils/unexpectedErrorMessage.js +6 -6
- package/cjs/utils/unexpectedErrorMessage.js.map +1 -1
- package/esm/_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/defineProperty.js +12 -0
- package/esm/_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/toPrimitive.js +14 -0
- package/esm/_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/toPropertyKey.js +9 -0
- package/esm/_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/typeof.js +11 -0
- package/esm/assert-order/AssertOrder.d.ts +42 -39
- package/esm/assert-order/AssertOrder.d.ts.map +1 -1
- package/esm/assert-order/AssertOrder.js +119 -143
- package/esm/assert-order/AssertOrder.js.map +1 -1
- package/esm/assert-order/InvalidOrder.d.ts +10 -7
- package/esm/assert-order/InvalidOrder.d.ts.map +1 -1
- package/esm/assert-order/InvalidOrder.js +24 -39
- package/esm/assert-order/InvalidOrder.js.map +1 -1
- package/esm/assert-order/StateMachine.js +99 -129
- package/esm/assert-order/StateMachine.js.map +1 -1
- package/esm/assert-order/index.d.ts +4 -4
- package/esm/assert-order/types.d.ts +9 -6
- package/esm/assert-order/types.d.ts.map +1 -1
- package/esm/assertron/assertron.d.ts +23 -20
- package/esm/assertron/assertron.d.ts.map +1 -1
- package/esm/assertron/assertron.js +36 -36
- package/esm/assertron/assertron.js.map +1 -1
- package/esm/assertron/falsy.js +7 -4
- package/esm/assertron/falsy.js.map +1 -1
- package/esm/assertron/index.d.ts +3 -3
- package/esm/assertron/isInstanceof.js +8 -5
- package/esm/assertron/isInstanceof.js.map +1 -1
- package/esm/assertron/pathEqual.js +9 -6
- package/esm/assertron/pathEqual.js.map +1 -1
- package/esm/assertron/rejects.js +10 -6
- package/esm/assertron/rejects.js.map +1 -1
- package/esm/assertron/repeat.js +22 -25
- package/esm/assertron/repeat.js.map +1 -1
- package/esm/assertron/resolves.js +10 -6
- package/esm/assertron/resolves.js.map +1 -1
- package/esm/assertron/satisfies.d.ts +5 -10
- package/esm/assertron/satisfies.d.ts.map +1 -1
- package/esm/assertron/satisfies.js +14 -12
- package/esm/assertron/satisfies.js.map +1 -1
- package/esm/assertron/throws.js +47 -49
- package/esm/assertron/throws.js.map +1 -1
- package/esm/assertron/truthy.js +7 -4
- package/esm/assertron/truthy.js.map +1 -1
- package/esm/errors.d.ts +13 -10
- package/esm/errors.d.ts.map +1 -1
- package/esm/errors.js +20 -26
- package/esm/errors.js.map +1 -1
- package/esm/index.d.ts +10 -8
- package/esm/index.js +10 -7
- package/esm/index.js.map +1 -1
- package/esm/types.d.ts +5 -2
- package/esm/types.d.ts.map +1 -1
- package/esm/utils/index.js +13 -9
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/isErrorConstructor.js +6 -2
- package/esm/utils/isErrorConstructor.js.map +1 -1
- package/esm/utils/notEqualMessage.js +6 -2
- package/esm/utils/notEqualMessage.js.map +1 -1
- package/esm/utils/notSatisfiedMessage.js +15 -20
- package/esm/utils/notSatisfiedMessage.js.map +1 -1
- package/esm/utils/notThrownMessage.js +7 -3
- package/esm/utils/notThrownMessage.js.map +1 -1
- package/esm/utils/promiseMessages.js +9 -11
- package/esm/utils/promiseMessages.js.map +1 -1
- package/esm/utils/unexpectedErrorMessage.js +8 -4
- package/esm/utils/unexpectedErrorMessage.js.map +1 -1
- package/package.json +43 -68
- package/ts/assert-order/AssertOrder.ts +8 -6
- package/ts/assert-order/InvalidOrder.ts +4 -6
- package/ts/assert-order/StateMachine.ts +11 -7
- package/ts/assertron/assertron.ts +9 -19
- package/ts/assertron/falsy.ts +1 -2
- package/ts/assertron/isInstanceof.ts +1 -4
- package/ts/assertron/pathEqual.ts +1 -2
- package/ts/assertron/rejects.ts +2 -2
- package/ts/assertron/repeat.ts +5 -6
- package/ts/assertron/resolves.ts +3 -3
- package/ts/assertron/satisfies.ts +2 -4
- package/ts/assertron/throws.ts +14 -20
- package/ts/assertron/truthy.ts +1 -2
- package/ts/errors.ts +5 -1
- package/ts/index.ts +2 -2
- package/ts/utils/index.ts +1 -1
- package/ts/utils/notSatisfiedMessage.ts +2 -2
- package/ts/utils/promiseMessages.ts +5 -5
- package/cjs/assert-order/StateMachine.d.ts +0 -22
- package/cjs/assert-order/StateMachine.d.ts.map +0 -1
- package/cjs/assert-order/index.d.ts.map +0 -1
- package/cjs/assert-order/index.js +0 -20
- package/cjs/assert-order/index.js.map +0 -1
- package/cjs/assert-order/types.js +0 -3
- package/cjs/assert-order/types.js.map +0 -1
- package/cjs/assertron/falsy.d.ts +0 -2
- package/cjs/assertron/falsy.d.ts.map +0 -1
- package/cjs/assertron/index.d.ts.map +0 -1
- package/cjs/assertron/index.js +0 -18
- package/cjs/assertron/index.js.map +0 -1
- package/cjs/assertron/isInstanceof.d.ts +0 -3
- package/cjs/assertron/isInstanceof.d.ts.map +0 -1
- package/cjs/assertron/pathEqual.d.ts +0 -2
- package/cjs/assertron/pathEqual.d.ts.map +0 -1
- package/cjs/assertron/rejects.d.ts +0 -2
- package/cjs/assertron/rejects.d.ts.map +0 -1
- package/cjs/assertron/repeat.d.ts +0 -6
- package/cjs/assertron/repeat.d.ts.map +0 -1
- package/cjs/assertron/resolves.d.ts +0 -2
- package/cjs/assertron/resolves.d.ts.map +0 -1
- package/cjs/assertron/throws.d.ts +0 -6
- package/cjs/assertron/throws.d.ts.map +0 -1
- package/cjs/assertron/truthy.d.ts +0 -2
- package/cjs/assertron/truthy.d.ts.map +0 -1
- package/cjs/index.d.ts.map +0 -1
- package/cjs/types.js +0 -3
- package/cjs/types.js.map +0 -1
- package/cjs/utils/index.d.ts +0 -8
- package/cjs/utils/index.d.ts.map +0 -1
- package/cjs/utils/isErrorConstructor.d.ts +0 -3
- package/cjs/utils/isErrorConstructor.d.ts.map +0 -1
- package/cjs/utils/notEqualMessage.d.ts +0 -2
- package/cjs/utils/notEqualMessage.d.ts.map +0 -1
- package/cjs/utils/notSatisfiedMessage.d.ts +0 -3
- package/cjs/utils/notSatisfiedMessage.d.ts.map +0 -1
- package/cjs/utils/notThrownMessage.d.ts +0 -2
- package/cjs/utils/notThrownMessage.d.ts.map +0 -1
- package/cjs/utils/promiseMessages.d.ts +0 -3
- package/cjs/utils/promiseMessages.d.ts.map +0 -1
- package/cjs/utils/unexpectedErrorMessage.d.ts +0 -3
- package/cjs/utils/unexpectedErrorMessage.d.ts.map +0 -1
- package/esm/assert-order/StateMachine.d.ts +0 -22
- package/esm/assert-order/StateMachine.d.ts.map +0 -1
- package/esm/assert-order/index.d.ts.map +0 -1
- package/esm/assert-order/index.js +0 -4
- package/esm/assert-order/index.js.map +0 -1
- package/esm/assert-order/types.js +0 -2
- package/esm/assert-order/types.js.map +0 -1
- package/esm/assertron/falsy.d.ts +0 -2
- package/esm/assertron/falsy.d.ts.map +0 -1
- package/esm/assertron/index.d.ts.map +0 -1
- package/esm/assertron/index.js +0 -2
- package/esm/assertron/index.js.map +0 -1
- package/esm/assertron/isInstanceof.d.ts +0 -3
- package/esm/assertron/isInstanceof.d.ts.map +0 -1
- package/esm/assertron/pathEqual.d.ts +0 -2
- package/esm/assertron/pathEqual.d.ts.map +0 -1
- package/esm/assertron/rejects.d.ts +0 -2
- package/esm/assertron/rejects.d.ts.map +0 -1
- package/esm/assertron/repeat.d.ts +0 -6
- package/esm/assertron/repeat.d.ts.map +0 -1
- package/esm/assertron/resolves.d.ts +0 -2
- package/esm/assertron/resolves.d.ts.map +0 -1
- package/esm/assertron/throws.d.ts +0 -6
- package/esm/assertron/throws.d.ts.map +0 -1
- package/esm/assertron/truthy.d.ts +0 -2
- package/esm/assertron/truthy.d.ts.map +0 -1
- package/esm/index.d.ts.map +0 -1
- package/esm/types.js +0 -2
- package/esm/types.js.map +0 -1
- package/esm/utils/index.d.ts +0 -8
- package/esm/utils/index.d.ts.map +0 -1
- package/esm/utils/isErrorConstructor.d.ts +0 -3
- package/esm/utils/isErrorConstructor.d.ts.map +0 -1
- package/esm/utils/notEqualMessage.d.ts +0 -2
- package/esm/utils/notEqualMessage.d.ts.map +0 -1
- package/esm/utils/notSatisfiedMessage.d.ts +0 -3
- package/esm/utils/notSatisfiedMessage.d.ts.map +0 -1
- package/esm/utils/notThrownMessage.d.ts +0 -2
- package/esm/utils/notThrownMessage.d.ts.map +0 -1
- package/esm/utils/promiseMessages.d.ts +0 -3
- package/esm/utils/promiseMessages.d.ts.map +0 -1
- package/esm/utils/unexpectedErrorMessage.d.ts +0 -3
- package/esm/utils/unexpectedErrorMessage.d.ts.map +0 -1
- package/ts/assert-order/internalInterfaces.ts +0 -5
- package/ts/testUtils.ts +0 -81
|
@@ -6,7 +6,7 @@ export class InvalidOrder extends AssertionError {
|
|
|
6
6
|
public state: State,
|
|
7
7
|
public method: string,
|
|
8
8
|
public args: any[],
|
|
9
|
-
options: AssertionError.Options
|
|
9
|
+
options: AssertionError.Options,
|
|
10
10
|
) {
|
|
11
11
|
super(method === 'end' ? getEndMessage(state) : getExpectingMessage(state, method, args), options)
|
|
12
12
|
}
|
|
@@ -24,16 +24,14 @@ function getExpectingCalls(state: State) {
|
|
|
24
24
|
let message: string
|
|
25
25
|
if (state.subStep === 0) {
|
|
26
26
|
const methods = ['is', 'once', 'any']
|
|
27
|
-
message = methods
|
|
28
|
-
.map(m => `'${m}(${['any'].indexOf(m) === -1 ? state.step : `[${state.step}]`})'`)
|
|
29
|
-
.join(', ')
|
|
27
|
+
message = methods.map((m) => `'${m}(${['any'].indexOf(m) === -1 ? state.step : `[${state.step}]`})'`).join(', ')
|
|
30
28
|
} else {
|
|
31
29
|
const methods = ['exactly']
|
|
32
|
-
message = methods.map(m => `'${m}(${state.step}, ${state.maxSubStep})'`).join(', ')
|
|
30
|
+
message = methods.map((m) => `'${m}(${state.step}, ${state.maxSubStep})'`).join(', ')
|
|
33
31
|
}
|
|
34
32
|
return message
|
|
35
33
|
}
|
|
36
34
|
|
|
37
35
|
function getMethodArgs(args: any[]) {
|
|
38
|
-
return args.map(a => (Array.isArray(a) ? `[${a.join(', ')}]` : a)).join(', ')
|
|
36
|
+
return args.map((a) => (Array.isArray(a) ? `[${a.join(', ')}]` : a)).join(', ')
|
|
39
37
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// Deliberately the bare specifier, not `node:perf_hooks`: package.json's `browser`
|
|
2
|
+
// field maps `perf_hooks` to `false` for bundlers, and that mapping does not apply to
|
|
3
|
+
// the `node:` prefixed form.
|
|
4
|
+
// biome-ignore lint/style/useNodejsImportProtocol: see above
|
|
1
5
|
import * as perf from 'perf_hooks'
|
|
2
6
|
import type { State } from './types.js'
|
|
3
7
|
|
|
@@ -12,7 +16,7 @@ if (typeof globalThis.process?.hrtime === 'function') {
|
|
|
12
16
|
taken() {
|
|
13
17
|
const [second, nanoSecond] = globalThis.process.hrtime(tick)
|
|
14
18
|
return second * 1000 + nanoSecond / 1e6
|
|
15
|
-
}
|
|
19
|
+
},
|
|
16
20
|
}
|
|
17
21
|
} else if (perf.performance && typeof perf.performance.now === 'function') {
|
|
18
22
|
const now = perf.performance.now
|
|
@@ -23,17 +27,17 @@ if (typeof globalThis.process?.hrtime === 'function') {
|
|
|
23
27
|
},
|
|
24
28
|
taken() {
|
|
25
29
|
return now() - tick
|
|
26
|
-
}
|
|
30
|
+
},
|
|
27
31
|
}
|
|
28
32
|
} else {
|
|
29
33
|
let tick: number
|
|
30
34
|
timeTracker = {
|
|
31
35
|
start() {
|
|
32
|
-
tick =
|
|
36
|
+
tick = Date.now()
|
|
33
37
|
},
|
|
34
38
|
taken() {
|
|
35
|
-
return
|
|
36
|
-
}
|
|
39
|
+
return Date.now() - tick
|
|
40
|
+
},
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
|
|
@@ -59,7 +63,7 @@ export class StateMachine {
|
|
|
59
63
|
this.step = this.step + 1
|
|
60
64
|
this.subStep = 0
|
|
61
65
|
if (listeners) {
|
|
62
|
-
|
|
66
|
+
for (const l of listeners) l()
|
|
63
67
|
}
|
|
64
68
|
return this.step
|
|
65
69
|
}
|
|
@@ -75,7 +79,7 @@ export class StateMachine {
|
|
|
75
79
|
maxStep,
|
|
76
80
|
subStep,
|
|
77
81
|
minSubStep,
|
|
78
|
-
maxSubStep
|
|
82
|
+
maxSubStep,
|
|
79
83
|
}
|
|
80
84
|
}
|
|
81
85
|
on(step: number, listener: () => void) {
|
|
@@ -8,7 +8,7 @@ import { pathEqual } from './pathEqual.js'
|
|
|
8
8
|
import { rejects } from './rejects.js'
|
|
9
9
|
import { repeat } from './repeat.js'
|
|
10
10
|
import { resolves } from './resolves.js'
|
|
11
|
-
import {
|
|
11
|
+
import { type SatisfyExpectation, satisfies } from './satisfies.js'
|
|
12
12
|
import { throws } from './throws.js'
|
|
13
13
|
import { truthy } from './truthy.js'
|
|
14
14
|
|
|
@@ -18,22 +18,16 @@ export type Assertron = {
|
|
|
18
18
|
isInstanceof<T extends AnyConstructor>(value: unknown, type: T): asserts value is InstanceType<T>
|
|
19
19
|
pathEqual(actual: string, expected: string): void
|
|
20
20
|
rejects<R = any>(promise: Promise<any>): Promise<R>
|
|
21
|
-
repeat<R>(
|
|
22
|
-
fn: () => R | (() => Promise<R>),
|
|
23
|
-
times: number
|
|
24
|
-
): ReturnType<typeof fn> extends Promise<R> ? Promise<R> : R
|
|
21
|
+
repeat<R>(fn: () => R | (() => Promise<R>), times: number): ReturnType<typeof fn> extends Promise<R> ? Promise<R> : R
|
|
25
22
|
resolves(promise: Promise<any>): Promise<void>
|
|
26
23
|
satisfies<Actual, Expected extends Actual>(actual: Actual, expected: SatisfyExpectation<Expected>): void
|
|
27
24
|
throws<E extends Error>(value: PromiseLike<any>, error?: ErrorValidator | ErrorConstructor<E>): Promise<E>
|
|
28
25
|
throws<E extends Error>(value: (...args: any[]) => never, error?: ErrorValidator | ErrorConstructor<E>): E
|
|
29
26
|
throws<E extends Error, R = any>(
|
|
30
27
|
value: (...args: any[]) => R,
|
|
31
|
-
error?: ErrorValidator | ErrorConstructor<E
|
|
28
|
+
error?: ErrorValidator | ErrorConstructor<E>,
|
|
32
29
|
): R extends Promise<any> ? Promise<E> : E
|
|
33
|
-
throws<T, R = any>(
|
|
34
|
-
value: (...args: any[]) => R,
|
|
35
|
-
validator?: ErrorValidator
|
|
36
|
-
): R extends Promise<any> ? Promise<T> : T
|
|
30
|
+
throws<T, R = any>(value: (...args: any[]) => R, validator?: ErrorValidator): R extends Promise<any> ? Promise<T> : T
|
|
37
31
|
true(value: unknown, message?: string | undefined): asserts value is true
|
|
38
32
|
truthy(value: unknown, message?: string | undefined): void
|
|
39
33
|
uuid(value: unknown): void
|
|
@@ -41,8 +35,7 @@ export type Assertron = {
|
|
|
41
35
|
|
|
42
36
|
export const assertron: Assertron = {
|
|
43
37
|
false(value: unknown, message?: string): void {
|
|
44
|
-
if (value !== false)
|
|
45
|
-
throw new AssertionError(message ?? notEqualMessage(value, false), { ssf: assertron.false })
|
|
38
|
+
if (value !== false) throw new AssertionError(message ?? notEqualMessage(value, false), { ssf: assertron.false })
|
|
46
39
|
},
|
|
47
40
|
falsy,
|
|
48
41
|
isInstanceof,
|
|
@@ -53,17 +46,14 @@ export const assertron: Assertron = {
|
|
|
53
46
|
satisfies,
|
|
54
47
|
throws,
|
|
55
48
|
true(value: unknown, message?: string): void {
|
|
56
|
-
if (value !== true)
|
|
57
|
-
throw new AssertionError(message ?? notEqualMessage(value, true), { ssf: assertron.true })
|
|
49
|
+
if (value !== true) throw new AssertionError(message ?? notEqualMessage(value, true), { ssf: assertron.true })
|
|
58
50
|
},
|
|
59
51
|
truthy,
|
|
60
52
|
uuid(value: unknown) {
|
|
61
|
-
if (typeof value !== 'string')
|
|
62
|
-
throw new AssertionError(`Expected ${value} to be a string`, { ssf: assertron.uuid })
|
|
53
|
+
if (typeof value !== 'string') throw new AssertionError(`Expected ${value} to be a string`, { ssf: assertron.uuid })
|
|
63
54
|
|
|
64
|
-
if (/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/.test(value))
|
|
65
|
-
return
|
|
55
|
+
if (/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/.test(value)) return
|
|
66
56
|
|
|
67
57
|
throw new AssertionError(`Expected ${value} to be a valid UUID`, { ssf: assertron.uuid })
|
|
68
|
-
}
|
|
58
|
+
},
|
|
69
59
|
}
|
package/ts/assertron/falsy.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AssertionError } from '../errors.js'
|
|
2
2
|
|
|
3
3
|
export function falsy(value: unknown, message?: string): void {
|
|
4
|
-
if (value)
|
|
5
|
-
throw new AssertionError(message ?? `Expected value to be falsy, but received ${value}`, { ssf: falsy })
|
|
4
|
+
if (value) throw new AssertionError(message ?? `Expected value to be falsy, but received ${value}`, { ssf: falsy })
|
|
6
5
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { AnyConstructor } from 'type-plus'
|
|
2
2
|
import { AssertionError } from '../errors.js'
|
|
3
3
|
|
|
4
|
-
export function isInstanceof<T extends AnyConstructor>(
|
|
5
|
-
value: unknown,
|
|
6
|
-
type: T
|
|
7
|
-
): asserts value is InstanceType<T> {
|
|
4
|
+
export function isInstanceof<T extends AnyConstructor>(value: unknown, type: T): asserts value is InstanceType<T> {
|
|
8
5
|
if (value instanceof type) return
|
|
9
6
|
|
|
10
7
|
throw new AssertionError(`Expected ${value} to be an instance of ${type.name}`, { ssf: isInstanceof })
|
|
@@ -3,6 +3,5 @@ import { AssertionError } from '../errors.js'
|
|
|
3
3
|
import { notEqualMessage } from '../utils/index.js'
|
|
4
4
|
|
|
5
5
|
export function pathEqual(actual: string, expected: string): void {
|
|
6
|
-
if (!isPathEqual(actual, expected))
|
|
7
|
-
throw new AssertionError(notEqualMessage(actual, expected), { ssf: pathEqual })
|
|
6
|
+
if (!isPathEqual(actual, expected)) throw new AssertionError(notEqualMessage(actual, expected), { ssf: pathEqual })
|
|
8
7
|
}
|
package/ts/assertron/rejects.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { notRejectedMessage } from '../utils/index.js'
|
|
|
3
3
|
|
|
4
4
|
export function rejects<R = any>(promise: Promise<unknown>): Promise<R> {
|
|
5
5
|
return promise.then(
|
|
6
|
-
value => {
|
|
6
|
+
(value) => {
|
|
7
7
|
throw new AssertionError(notRejectedMessage(value), { ssf: rejects })
|
|
8
8
|
},
|
|
9
|
-
err => err
|
|
9
|
+
(err) => err,
|
|
10
10
|
)
|
|
11
11
|
}
|
package/ts/assertron/repeat.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { FailOnOccurrence } from '../errors.js'
|
|
|
7
7
|
*/
|
|
8
8
|
export function repeat<R>(
|
|
9
9
|
fn: () => R | (() => Promise<R>),
|
|
10
|
-
times: number
|
|
10
|
+
times: number,
|
|
11
11
|
): ReturnType<typeof fn> extends Promise<R> ? Promise<R> : R {
|
|
12
12
|
return repeatRecur(fn, 1, times)
|
|
13
13
|
}
|
|
@@ -15,7 +15,7 @@ export function repeat<R>(
|
|
|
15
15
|
function repeatRecur<R>(
|
|
16
16
|
fn: () => R | (() => Promise<R>),
|
|
17
17
|
i: number,
|
|
18
|
-
times: number
|
|
18
|
+
times: number,
|
|
19
19
|
): ReturnType<typeof fn> extends Promise<R> ? Promise<R> : R {
|
|
20
20
|
try {
|
|
21
21
|
const result = fn()
|
|
@@ -24,13 +24,12 @@ function repeatRecur<R>(
|
|
|
24
24
|
if (isPromise(result)) {
|
|
25
25
|
return result.then(
|
|
26
26
|
() => repeatRecur(fn, i + 1, times),
|
|
27
|
-
e => {
|
|
27
|
+
(e) => {
|
|
28
28
|
throw new FailOnOccurrence(i, e, { ssf: repeat })
|
|
29
|
-
}
|
|
29
|
+
},
|
|
30
30
|
) as any
|
|
31
|
-
} else {
|
|
32
|
-
return repeatRecur(fn, i + 1, times)
|
|
33
31
|
}
|
|
32
|
+
return repeatRecur(fn, i + 1, times)
|
|
34
33
|
} catch (e) {
|
|
35
34
|
if (e instanceof FailOnOccurrence) throw e
|
|
36
35
|
throw new FailOnOccurrence(i, e, { ssf: repeat })
|
package/ts/assertron/resolves.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { notResolvedMessage } from '../utils/index.js'
|
|
|
3
3
|
|
|
4
4
|
export function resolves(promise: Promise<any>): Promise<void> {
|
|
5
5
|
return promise.then(
|
|
6
|
-
v => v,
|
|
7
|
-
error => {
|
|
6
|
+
(v) => v,
|
|
7
|
+
(error) => {
|
|
8
8
|
throw new AssertionError(notResolvedMessage(error), { ssf: resolves })
|
|
9
|
-
}
|
|
9
|
+
},
|
|
10
10
|
)
|
|
11
11
|
}
|
|
@@ -14,9 +14,7 @@ export type SatisfyExpectation<T> =
|
|
|
14
14
|
IsExtend<T, Array<any>>,
|
|
15
15
|
T extends Array<infer E> ? Array<SatisfyExpectation<E>> : never,
|
|
16
16
|
{
|
|
17
|
-
[P in keyof T]?: T[P] extends string
|
|
18
|
-
? SatisfyExpectation<T[P]> | RegExp
|
|
19
|
-
: SatisfyExpectation<T[P]>
|
|
17
|
+
[P in keyof T]?: T[P] extends string ? SatisfyExpectation<T[P]> | RegExp : SatisfyExpectation<T[P]>
|
|
20
18
|
}
|
|
21
19
|
>
|
|
22
20
|
>
|
|
@@ -30,7 +28,7 @@ export type SatisfyExpectation<T> =
|
|
|
30
28
|
*/
|
|
31
29
|
export function satisfies<Actual, Expected extends Actual>(
|
|
32
30
|
actual: Actual,
|
|
33
|
-
expected: SatisfyExpectation<Expected
|
|
31
|
+
expected: SatisfyExpectation<Expected>,
|
|
34
32
|
): void {
|
|
35
33
|
const diff = createSatisfier(expected as any).exec(actual)
|
|
36
34
|
if (diff) {
|
package/ts/assertron/throws.ts
CHANGED
|
@@ -1,36 +1,31 @@
|
|
|
1
1
|
import isPromise from 'is-promise'
|
|
2
2
|
import { AssertionError } from '../errors.js'
|
|
3
3
|
import type { ErrorConstructor, ErrorValidator } from '../types.js'
|
|
4
|
-
import {
|
|
5
|
-
isErrorConstructor,
|
|
6
|
-
notRejectedMessage,
|
|
7
|
-
notThrownMessage,
|
|
8
|
-
unexpectedErrorMessage
|
|
9
|
-
} from '../utils/index.js'
|
|
4
|
+
import { isErrorConstructor, notRejectedMessage, notThrownMessage, unexpectedErrorMessage } from '../utils/index.js'
|
|
10
5
|
|
|
11
6
|
export function throws<E extends Error>(
|
|
12
7
|
value: PromiseLike<any>,
|
|
13
|
-
error?: ErrorValidator | ErrorConstructor<E
|
|
8
|
+
error?: ErrorValidator | ErrorConstructor<E>,
|
|
14
9
|
): Promise<E>
|
|
15
10
|
export function throws<E extends Error>(
|
|
16
11
|
value: (...args: any[]) => never,
|
|
17
|
-
error?: ErrorValidator | ErrorConstructor<E
|
|
12
|
+
error?: ErrorValidator | ErrorConstructor<E>,
|
|
18
13
|
): E
|
|
19
14
|
export function throws<E extends Error, R = any>(
|
|
20
15
|
value: (...args: any[]) => R,
|
|
21
|
-
error?: ErrorValidator | ErrorConstructor<E
|
|
16
|
+
error?: ErrorValidator | ErrorConstructor<E>,
|
|
22
17
|
): R extends Promise<any> ? Promise<E> : E
|
|
23
18
|
export function throws<T, R = any>(
|
|
24
19
|
value: (...args: any[]) => R,
|
|
25
|
-
validator?: ErrorValidator
|
|
20
|
+
validator?: ErrorValidator,
|
|
26
21
|
): R extends Promise<any> ? Promise<T> : T
|
|
27
22
|
export function throws(
|
|
28
23
|
value: PromiseLike<any> | (() => any | PromiseLike<any>),
|
|
29
|
-
validator?: ErrorValidator | ErrorConstructor<any
|
|
24
|
+
validator?: ErrorValidator | ErrorConstructor<any>,
|
|
30
25
|
): any {
|
|
31
26
|
if (typeof value !== 'function' && !isPromise(value)) {
|
|
32
27
|
throw new AssertionError('`assertron.throws()` must be called with a function or promise.', {
|
|
33
|
-
ssf: throws
|
|
28
|
+
ssf: throws,
|
|
34
29
|
})
|
|
35
30
|
}
|
|
36
31
|
|
|
@@ -47,15 +42,15 @@ export function throws(
|
|
|
47
42
|
|
|
48
43
|
if (isPromise(value)) {
|
|
49
44
|
return value.then(
|
|
50
|
-
value => {
|
|
45
|
+
(value) => {
|
|
51
46
|
throw new AssertionError(notRejectedMessage(value), { ssf: throws })
|
|
52
47
|
},
|
|
53
|
-
err => {
|
|
48
|
+
(err) => {
|
|
54
49
|
if (failValidation(validator, err)) {
|
|
55
50
|
throw new AssertionError(unexpectedErrorMessage(err, validator), { ssf: throws, cause: err })
|
|
56
51
|
}
|
|
57
52
|
return err
|
|
58
|
-
}
|
|
53
|
+
},
|
|
59
54
|
)
|
|
60
55
|
}
|
|
61
56
|
|
|
@@ -63,8 +58,8 @@ export function throws(
|
|
|
63
58
|
}
|
|
64
59
|
|
|
65
60
|
function tryCatch(fn: () => any) {
|
|
66
|
-
let result
|
|
67
|
-
let err
|
|
61
|
+
let result: any
|
|
62
|
+
let err: any
|
|
68
63
|
let threw = false
|
|
69
64
|
try {
|
|
70
65
|
result = fn()
|
|
@@ -76,13 +71,12 @@ function tryCatch(fn: () => any) {
|
|
|
76
71
|
}
|
|
77
72
|
function failValidation(
|
|
78
73
|
validator: ErrorValidator | ErrorConstructor<any> | undefined,
|
|
79
|
-
error: any
|
|
74
|
+
error: any,
|
|
80
75
|
): validator is ErrorValidator | ErrorConstructor<any> {
|
|
81
76
|
if (!validator) return false
|
|
82
77
|
|
|
83
78
|
if (isErrorConstructor(validator)) {
|
|
84
79
|
return !(error instanceof validator)
|
|
85
|
-
} else {
|
|
86
|
-
return !validator(error)
|
|
87
80
|
}
|
|
81
|
+
return !validator(error)
|
|
88
82
|
}
|
package/ts/assertron/truthy.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AssertionError } from '../errors.js'
|
|
2
2
|
|
|
3
3
|
export function truthy(value: unknown, message?: string | undefined): void {
|
|
4
|
-
if (!value)
|
|
5
|
-
throw new AssertionError(message ?? `Expected value to be truthy, but received ${value}`, { ssf: truthy })
|
|
4
|
+
if (!value) throw new AssertionError(message ?? `Expected value to be truthy, but received ${value}`, { ssf: truthy })
|
|
6
5
|
}
|
package/ts/errors.ts
CHANGED
|
@@ -16,7 +16,11 @@ export namespace AssertionError {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export class FailOnOccurrence extends AssertionError {
|
|
19
|
-
constructor(
|
|
19
|
+
constructor(
|
|
20
|
+
public occurrence: number,
|
|
21
|
+
public error: any,
|
|
22
|
+
options: AssertionError.Options,
|
|
23
|
+
) {
|
|
20
24
|
super(failOnOccurrence(occurrence, error), options)
|
|
21
25
|
}
|
|
22
26
|
}
|
package/ts/index.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { assertron } from './assertron/index.js'
|
|
|
2
2
|
|
|
3
3
|
export {
|
|
4
4
|
anything,
|
|
5
|
-
has,
|
|
6
5
|
every,
|
|
6
|
+
has,
|
|
7
7
|
hasAll,
|
|
8
8
|
isInClosedInterval,
|
|
9
9
|
isInLeftClosedInterval,
|
|
@@ -13,7 +13,7 @@ export {
|
|
|
13
13
|
isTypeOf,
|
|
14
14
|
none,
|
|
15
15
|
some,
|
|
16
|
-
startsWith
|
|
16
|
+
startsWith,
|
|
17
17
|
} from 'satisfier'
|
|
18
18
|
export * from './assert-order/index.js'
|
|
19
19
|
export * from './assertron/index.js'
|
package/ts/utils/index.ts
CHANGED
|
@@ -8,5 +8,5 @@ export * from './promiseMessages.js'
|
|
|
8
8
|
export * from './unexpectedErrorMessage.js'
|
|
9
9
|
|
|
10
10
|
export function failOnOccurrence(occurrence: number, error: any) {
|
|
11
|
-
return `Failed on ${occurrence} occurrence: ${tersify(error, { maxLength:
|
|
11
|
+
return `Failed on ${occurrence} occurrence: ${tersify(error, { maxLength: Number.POSITIVE_INFINITY })}`
|
|
12
12
|
}
|
|
@@ -3,7 +3,7 @@ import { tersify } from 'tersify'
|
|
|
3
3
|
|
|
4
4
|
export function notSatisfiedMessage(entries: Diff[]) {
|
|
5
5
|
return entries
|
|
6
|
-
.map(e => {
|
|
6
|
+
.map((e) => {
|
|
7
7
|
const path = formatPath(e.path)
|
|
8
8
|
return `Expect ${path} to satisfy ${formatValue(e.expected)}, but received ${formatValue(e.actual)}`
|
|
9
9
|
})
|
|
@@ -17,7 +17,7 @@ function formatPath(entries: (string | number)[]) {
|
|
|
17
17
|
nodes.unshift('actual')
|
|
18
18
|
}
|
|
19
19
|
return nodes
|
|
20
|
-
.map(n => (isIndice(n) ? `[${n}]` : '.' + n))
|
|
20
|
+
.map((n) => (isIndice(n) ? `[${n}]` : '.' + n))
|
|
21
21
|
.join('')
|
|
22
22
|
.slice(1)
|
|
23
23
|
}
|
|
@@ -2,18 +2,18 @@ import { tersify } from 'tersify'
|
|
|
2
2
|
|
|
3
3
|
export function notRejectedMessage(value: any) {
|
|
4
4
|
return (
|
|
5
|
-
|
|
6
|
-
(typeof value === 'string' ? `'${value}'` : tersify(value, { maxLength:
|
|
5
|
+
'Expected promise to reject, but it resolves with ' +
|
|
6
|
+
(typeof value === 'string' ? `'${value}'` : tersify(value, { maxLength: Number.POSITIVE_INFINITY }))
|
|
7
7
|
)
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export function notResolvedMessage(error: any) {
|
|
11
11
|
return (
|
|
12
|
-
|
|
12
|
+
'Expected promise to resolve, but it rejects with ' +
|
|
13
13
|
(typeof error === 'string'
|
|
14
14
|
? `'${error}'`
|
|
15
15
|
: error instanceof Error
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
? error
|
|
17
|
+
: tersify(error, { maxLength: Number.POSITIVE_INFINITY }))
|
|
18
18
|
)
|
|
19
19
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { State } from './types.js';
|
|
2
|
-
export declare class StateMachine {
|
|
3
|
-
listeners: Record<number, Array<() => void>>;
|
|
4
|
-
step: number;
|
|
5
|
-
maxStep?: number;
|
|
6
|
-
subStep: number;
|
|
7
|
-
minSubStep?: number;
|
|
8
|
-
maxSubStep?: number;
|
|
9
|
-
constructor(maxStep?: number);
|
|
10
|
-
jump(step: number): number;
|
|
11
|
-
move(): number;
|
|
12
|
-
moveSubStep(): number;
|
|
13
|
-
get(): State;
|
|
14
|
-
on(step: number, listener: () => void): void;
|
|
15
|
-
isNotValid(step: number): boolean;
|
|
16
|
-
isValid(step: number): boolean;
|
|
17
|
-
isMaxStepDefined(): boolean;
|
|
18
|
-
stopAccepting(): void;
|
|
19
|
-
isAccepting(): boolean;
|
|
20
|
-
getTimeTaken(): number;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=StateMachine.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StateMachine.d.ts","sourceRoot":"","sources":["../../ts/assert-order/StateMachine.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAsCvC,qBAAa,YAAY;IACxB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAK;IACjD,IAAI,SAAI;IACR,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,OAAO,SAAI;IACX,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;gBACP,OAAO,CAAC,EAAE,MAAM;IAI5B,IAAI,CAAC,IAAI,EAAE,MAAM;IAKjB,IAAI;IASJ,WAAW;IAKX,GAAG,IAAI,KAAK;IAUZ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI;IAGrC,UAAU,CAAC,IAAI,EAAE,MAAM;IAGvB,OAAO,CAAC,IAAI,EAAE,MAAM;IAGpB,gBAAgB;IAGhB,aAAa;IAGb,WAAW;IAIX,YAAY;CAGZ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/assert-order/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./AssertOrder.js"), exports);
|
|
18
|
-
__exportStar(require("./InvalidOrder.js"), exports);
|
|
19
|
-
__exportStar(require("./types.js"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/assert-order/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAgC;AAChC,oDAAiC;AACjC,6CAA0B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../ts/assert-order/types.ts"],"names":[],"mappings":""}
|
package/cjs/assertron/falsy.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"falsy.d.ts","sourceRoot":"","sources":["../../ts/assertron/falsy.ts"],"names":[],"mappings":"AAEA,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAG5D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/assertron/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA"}
|
package/cjs/assertron/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./assertron.js"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/assertron/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isInstanceof.d.ts","sourceRoot":"","sources":["../../ts/assertron/isInstanceof.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAG/C,wBAAgB,YAAY,CAAC,CAAC,SAAS,cAAc,EACpD,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,CAAC,GACL,OAAO,CAAC,KAAK,IAAI,YAAY,CAAC,CAAC,CAAC,CAIlC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pathEqual.d.ts","sourceRoot":"","sources":["../../ts/assertron/pathEqual.ts"],"names":[],"mappings":"AAIA,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAGhE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rejects.d.ts","sourceRoot":"","sources":["../../ts/assertron/rejects.ts"],"names":[],"mappings":"AAGA,wBAAgB,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAOtE"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Repeat the specified function n times and return the last result.
|
|
3
|
-
* If the result is a promise, it will run the function sequentially.
|
|
4
|
-
*/
|
|
5
|
-
export declare function repeat<R>(fn: () => R | (() => Promise<R>), times: number): ReturnType<typeof fn> extends Promise<R> ? Promise<R> : R;
|
|
6
|
-
//# sourceMappingURL=repeat.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repeat.d.ts","sourceRoot":"","sources":["../../ts/assertron/repeat.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,MAAM,CAAC,CAAC,EACvB,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,EAChC,KAAK,EAAE,MAAM,GACX,UAAU,CAAC,OAAO,EAAE,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAE3D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolves.d.ts","sourceRoot":"","sources":["../../ts/assertron/resolves.ts"],"names":[],"mappings":"AAGA,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAO7D"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ErrorConstructor, ErrorValidator } from '../types.js';
|
|
2
|
-
export declare function throws<E extends Error>(value: PromiseLike<any>, error?: ErrorValidator | ErrorConstructor<E>): Promise<E>;
|
|
3
|
-
export declare function throws<E extends Error>(value: (...args: any[]) => never, error?: ErrorValidator | ErrorConstructor<E>): E;
|
|
4
|
-
export declare function throws<E extends Error, R = any>(value: (...args: any[]) => R, error?: ErrorValidator | ErrorConstructor<E>): R extends Promise<any> ? Promise<E> : E;
|
|
5
|
-
export declare function throws<T, R = any>(value: (...args: any[]) => R, validator?: ErrorValidator): R extends Promise<any> ? Promise<T> : T;
|
|
6
|
-
//# sourceMappingURL=throws.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throws.d.ts","sourceRoot":"","sources":["../../ts/assertron/throws.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAQnE,wBAAgB,MAAM,CAAC,CAAC,SAAS,KAAK,EACrC,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,EACvB,KAAK,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAC1C,OAAO,CAAC,CAAC,CAAC,CAAA;AACb,wBAAgB,MAAM,CAAC,CAAC,SAAS,KAAK,EACrC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,KAAK,EAChC,KAAK,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAC1C,CAAC,CAAA;AACJ,wBAAgB,MAAM,CAAC,CAAC,SAAS,KAAK,EAAE,CAAC,GAAG,GAAG,EAC9C,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAC5B,KAAK,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAC1C,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAC1C,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,EAChC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAC5B,SAAS,CAAC,EAAE,cAAc,GACxB,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"truthy.d.ts","sourceRoot":"","sources":["../../ts/assertron/truthy.ts"],"names":[],"mappings":"AAEA,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAGzE"}
|
package/cjs/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAEhD,OAAO,EACN,QAAQ,EACR,GAAG,EACH,KAAK,EACL,MAAM,EACN,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,SAAS,EACT,uBAAuB,EACvB,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,MAAM,WAAW,CAAA;AAClB,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,SAAS,IAAI,CAAC,EAAE,CAAA;AAEzB,eAAe,SAAS,CAAA"}
|
package/cjs/types.js
DELETED
package/cjs/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../ts/types.ts"],"names":[],"mappings":""}
|
package/cjs/utils/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from './isErrorConstructor.js';
|
|
2
|
-
export * from './notEqualMessage.js';
|
|
3
|
-
export * from './notSatisfiedMessage.js';
|
|
4
|
-
export * from './notThrownMessage.js';
|
|
5
|
-
export * from './promiseMessages.js';
|
|
6
|
-
export * from './unexpectedErrorMessage.js';
|
|
7
|
-
export declare function failOnOccurrence(occurrence: number, error: any): string;
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|