assertron 9.2.0 → 9.2.3
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.d.ts +41 -0
- package/cjs/assert-order/AssertOrder.d.ts.map +1 -0
- package/cjs/assert-order/InvalidOrder.d.ts +9 -0
- package/cjs/assert-order/InvalidOrder.d.ts.map +1 -0
- package/cjs/assert-order/StateMachine.d.ts +22 -0
- package/cjs/assert-order/StateMachine.d.ts.map +1 -0
- package/cjs/assert-order/index.d.ts +4 -0
- package/cjs/assert-order/index.d.ts.map +1 -0
- package/cjs/assert-order/types.d.ts +8 -0
- package/cjs/assert-order/types.d.ts.map +1 -0
- package/cjs/assertron/assertron.d.ts +21 -0
- package/cjs/assertron/assertron.d.ts.map +1 -0
- package/cjs/assertron/falsy.d.ts +2 -0
- package/cjs/assertron/falsy.d.ts.map +1 -0
- package/cjs/assertron/index.d.ts +2 -0
- package/cjs/assertron/index.d.ts.map +1 -0
- package/cjs/assertron/pathEqual.d.ts +2 -0
- package/cjs/assertron/pathEqual.d.ts.map +1 -0
- package/cjs/assertron/rejects.d.ts +2 -0
- package/cjs/assertron/rejects.d.ts.map +1 -0
- package/cjs/assertron/rejects.js.map +1 -1
- package/cjs/assertron/repeat.d.ts +6 -0
- package/cjs/assertron/repeat.d.ts.map +1 -0
- package/cjs/assertron/resolves.d.ts +2 -0
- package/cjs/assertron/resolves.d.ts.map +1 -0
- package/cjs/assertron/satisfies.d.ts +10 -0
- package/cjs/assertron/satisfies.d.ts.map +1 -0
- package/cjs/assertron/throws.d.ts +6 -0
- package/cjs/assertron/throws.d.ts.map +1 -0
- package/cjs/assertron/truthy.d.ts +2 -0
- package/cjs/assertron/truthy.d.ts.map +1 -0
- package/cjs/errors.d.ts +17 -0
- package/cjs/errors.d.ts.map +1 -0
- package/cjs/index.d.ts +7 -0
- package/cjs/index.d.ts.map +1 -0
- package/cjs/types.d.ts +3 -0
- package/cjs/types.d.ts.map +1 -0
- package/cjs/utils/index.d.ts +8 -0
- package/cjs/utils/index.d.ts.map +1 -0
- package/cjs/utils/isErrorConstructor.d.ts +3 -0
- package/cjs/utils/isErrorConstructor.d.ts.map +1 -0
- package/cjs/utils/notEqualMessage.d.ts +2 -0
- package/cjs/utils/notEqualMessage.d.ts.map +1 -0
- package/cjs/utils/notSatisfiedMessage.d.ts +3 -0
- package/cjs/utils/notSatisfiedMessage.d.ts.map +1 -0
- package/cjs/utils/notThrownMessage.d.ts +2 -0
- package/cjs/utils/notThrownMessage.d.ts.map +1 -0
- package/cjs/utils/promiseMessages.d.ts +3 -0
- package/cjs/utils/promiseMessages.d.ts.map +1 -0
- package/cjs/utils/unexpectedErrorMessage.d.ts +3 -0
- package/cjs/utils/unexpectedErrorMessage.d.ts.map +1 -0
- package/esm/assert-order/AssertOrder.d.ts +41 -0
- package/esm/assert-order/AssertOrder.d.ts.map +1 -0
- package/esm/assert-order/InvalidOrder.d.ts +9 -0
- package/esm/assert-order/InvalidOrder.d.ts.map +1 -0
- package/esm/assert-order/StateMachine.d.ts +22 -0
- package/esm/assert-order/StateMachine.d.ts.map +1 -0
- package/esm/assert-order/index.d.ts +4 -0
- package/esm/assert-order/index.d.ts.map +1 -0
- package/esm/assert-order/types.d.ts +8 -0
- package/esm/assert-order/types.d.ts.map +1 -0
- package/esm/assertron/assertron.d.ts +21 -0
- package/esm/assertron/assertron.d.ts.map +1 -0
- package/esm/assertron/falsy.d.ts +2 -0
- package/esm/assertron/falsy.d.ts.map +1 -0
- package/esm/assertron/index.d.ts +2 -0
- package/esm/assertron/index.d.ts.map +1 -0
- package/esm/assertron/pathEqual.d.ts +2 -0
- package/esm/assertron/pathEqual.d.ts.map +1 -0
- package/esm/assertron/rejects.d.ts +2 -0
- package/esm/assertron/rejects.d.ts.map +1 -0
- package/esm/assertron/rejects.js.map +1 -1
- package/esm/assertron/repeat.d.ts +6 -0
- package/esm/assertron/repeat.d.ts.map +1 -0
- package/esm/assertron/resolves.d.ts +2 -0
- package/esm/assertron/resolves.d.ts.map +1 -0
- package/esm/assertron/satisfies.d.ts +10 -0
- package/esm/assertron/satisfies.d.ts.map +1 -0
- package/esm/assertron/throws.d.ts +6 -0
- package/esm/assertron/throws.d.ts.map +1 -0
- package/esm/assertron/truthy.d.ts +2 -0
- package/esm/assertron/truthy.d.ts.map +1 -0
- package/esm/errors.d.ts +17 -0
- package/esm/errors.d.ts.map +1 -0
- package/esm/index.d.ts +7 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/types.d.ts +3 -0
- package/esm/types.d.ts.map +1 -0
- package/esm/utils/index.d.ts +8 -0
- package/esm/utils/index.d.ts.map +1 -0
- package/esm/utils/isErrorConstructor.d.ts +3 -0
- package/esm/utils/isErrorConstructor.d.ts.map +1 -0
- package/esm/utils/notEqualMessage.d.ts +2 -0
- package/esm/utils/notEqualMessage.d.ts.map +1 -0
- package/esm/utils/notSatisfiedMessage.d.ts +3 -0
- package/esm/utils/notSatisfiedMessage.d.ts.map +1 -0
- package/esm/utils/notThrownMessage.d.ts +2 -0
- package/esm/utils/notThrownMessage.d.ts.map +1 -0
- package/esm/utils/promiseMessages.d.ts +3 -0
- package/esm/utils/promiseMessages.d.ts.map +1 -0
- package/esm/utils/unexpectedErrorMessage.d.ts +3 -0
- package/esm/utils/unexpectedErrorMessage.d.ts.map +1 -0
- package/package.json +19 -15
- package/ts/assertron/rejects.ts +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare class AssertOrder {
|
|
2
|
+
/**
|
|
3
|
+
* Gets the current expecting step.
|
|
4
|
+
*/
|
|
5
|
+
get currentStep(): number;
|
|
6
|
+
private state;
|
|
7
|
+
constructor(plan?: number);
|
|
8
|
+
/**
|
|
9
|
+
* Asserts the current step is `step`.
|
|
10
|
+
* @param step expected step.
|
|
11
|
+
*/
|
|
12
|
+
is(step: number): void;
|
|
13
|
+
/**
|
|
14
|
+
* Asserts the current step is not `step`.
|
|
15
|
+
* @param step not expected step.
|
|
16
|
+
*/
|
|
17
|
+
not(step: number): void;
|
|
18
|
+
/**
|
|
19
|
+
* Reset to specified step.
|
|
20
|
+
*/
|
|
21
|
+
jump(step: number): void;
|
|
22
|
+
/**
|
|
23
|
+
* Move to next step.
|
|
24
|
+
*/
|
|
25
|
+
move(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Asserts the specified step will run once.
|
|
28
|
+
*/
|
|
29
|
+
once(step: number): void;
|
|
30
|
+
on(step: number, assert: (step: number) => void): void;
|
|
31
|
+
atLeastOnce(step: number): number;
|
|
32
|
+
any(steps: number[]): number;
|
|
33
|
+
onAny(steps: number[], ...asserts: Array<(...args: any[]) => any>): void;
|
|
34
|
+
end(timeout: number): Promise<number>;
|
|
35
|
+
end(): number;
|
|
36
|
+
exactly(step: number, times: number): number;
|
|
37
|
+
wait(step: number): Promise<void>;
|
|
38
|
+
wait(step: number, callback: () => void): void;
|
|
39
|
+
private assert;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=AssertOrder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssertOrder.d.ts","sourceRoot":"","sources":["../../ts/assert-order/AssertOrder.ts"],"names":[],"mappings":"AAMA,qBAAa,WAAW;IACtB;;OAEG;IACH,IAAI,WAAW,WAEd;IAED,OAAO,CAAC,KAAK,CAAc;gBACf,IAAI,CAAC,EAAE,MAAM;IAIzB;;;OAGG;IACH,EAAE,CAAC,IAAI,EAAE,MAAM;IAIf;;;OAGG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM;IAMhB;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM;IAIjB;;OAEG;IACH,IAAI;IAIJ;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM;IAKjB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI;IAM/C,WAAW,CAAC,IAAI,EAAE,MAAM;IAaxB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE;IAQnB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;IAoBjE,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IACrC,GAAG,IAAI,MAAM;IAmBb,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAWnC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IACjC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAO9C,OAAO,CAAC,MAAM;CAKf"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AssertionError } from '../errors.js';
|
|
2
|
+
import { State } from './types.js';
|
|
3
|
+
export declare class InvalidOrder extends AssertionError {
|
|
4
|
+
state: State;
|
|
5
|
+
method: string;
|
|
6
|
+
args: any[];
|
|
7
|
+
constructor(state: State, method: string, args: any[], options: AssertionError.Options);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=InvalidOrder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvalidOrder.d.ts","sourceRoot":"","sources":["../../ts/assert-order/InvalidOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAElC,qBAAa,YAAa,SAAQ,cAAc;IAC3B,KAAK,EAAE,KAAK;IAAS,MAAM,EAAE,MAAM;IAAS,IAAI,EAAE,GAAG,EAAE;gBAAvD,KAAK,EAAE,KAAK,EAAS,MAAM,EAAE,MAAM,EAAS,IAAI,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,cAAc,CAAC,OAAO;CAG5G"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StateMachine.d.ts","sourceRoot":"","sources":["../../ts/assert-order/StateMachine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AA4ClC,qBAAa,YAAY;IACvB,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;IAMX,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;CAGb"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../ts/assert-order/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { falsy } from './falsy.js';
|
|
2
|
+
import { pathEqual } from './pathEqual.js';
|
|
3
|
+
import { rejects } from './rejects.js';
|
|
4
|
+
import { repeat } from './repeat.js';
|
|
5
|
+
import { resolves } from './resolves.js';
|
|
6
|
+
import { satisfies } from './satisfies.js';
|
|
7
|
+
import { throws } from './throws.js';
|
|
8
|
+
import { truthy } from './truthy.js';
|
|
9
|
+
export declare const assertron: {
|
|
10
|
+
false(value: any): void;
|
|
11
|
+
falsy: typeof falsy;
|
|
12
|
+
pathEqual: typeof pathEqual;
|
|
13
|
+
rejects: typeof rejects;
|
|
14
|
+
repeat: typeof repeat;
|
|
15
|
+
resolves: typeof resolves;
|
|
16
|
+
satisfies: typeof satisfies;
|
|
17
|
+
throws: typeof throws;
|
|
18
|
+
true(value: any): void;
|
|
19
|
+
truthy: typeof truthy;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=assertron.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertron.d.ts","sourceRoot":"","sources":["../../ts/assertron/assertron.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,eAAO,MAAM,SAAS;iBACP,GAAG;;;;;;;;gBAWJ,GAAG;;CAKhB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"falsy.d.ts","sourceRoot":"","sources":["../../ts/assertron/falsy.ts"],"names":[],"mappings":"AAEA,wBAAgB,KAAK,CAAC,KAAK,EAAE,GAAG,QAG/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/assertron/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
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,QAGzD"}
|
|
@@ -0,0 +1 @@
|
|
|
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,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAKlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rejects.js","sourceRoot":"","sources":["../../ts/assertron/rejects.ts"],"names":[],"mappings":";;;AAAA,0CAA6C;AAC7C,8CAAsD;AAEtD,SAAgB,OAAO,
|
|
1
|
+
{"version":3,"file":"rejects.js","sourceRoot":"","sources":["../../ts/assertron/rejects.ts"],"names":[],"mappings":";;;AAAA,0CAA6C;AAC7C,8CAAsD;AAEtD,SAAgB,OAAO,CAAU,OAAqB;IACpD,OAAO,OAAO,CAAC,IAAI,CACjB,UAAA,KAAK,IAAM,MAAM,IAAI,0BAAc,CAAC,IAAA,6BAAkB,EAAC,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAA,CAAC,CAAC,EAClF,UAAA,GAAG,IAAI,OAAA,GAAG,EAAH,CAAG,CACX,CAAA;AACH,CAAC;AALD,0BAKC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repeat.d.ts","sourceRoot":"","sources":["../../ts/assertron/repeat.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAEpI"}
|
|
@@ -0,0 +1 @@
|
|
|
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,iBAK7C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { If, IsExtend, NonComposableTypes } from 'type-plus';
|
|
2
|
+
export declare type SatisfyExpectation<T> = If<IsExtend<T, string>, T | RegExp, If<IsExtend<T, NonComposableTypes>, T, If<IsExtend<T, Array<any>>, T extends Array<infer E> ? Array<SatisfyExpectation<E>> : never, {
|
|
3
|
+
[P in keyof T]?: T[P] extends string ? SatisfyExpectation<T[P]> | RegExp : SatisfyExpectation<T[P]>;
|
|
4
|
+
}>>> | ((v: T) => boolean);
|
|
5
|
+
/**
|
|
6
|
+
* Check if `actual` satisfies criteria in `expected`.
|
|
7
|
+
* @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.
|
|
8
|
+
*/
|
|
9
|
+
export declare function satisfies<Actual, Expected extends Actual>(actual: Actual, expected: SatisfyExpectation<Expected>): void;
|
|
10
|
+
//# sourceMappingURL=satisfies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"satisfies.d.ts","sourceRoot":"","sources":["../../ts/assertron/satisfies.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAI5D,oBAAY,kBAAkB,CAAC,CAAC,IAAI,EAAE,CACpC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,EACnB,CAAC,GAAG,MAAM,EACV,EAAE,CACA,QAAQ,CAAC,CAAC,EAAE,kBAAkB,CAAC,EAC/B,CAAC,EACD,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,EACxB,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,EAC/D;KACG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAClC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,GACjC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3B,CACF,CAAC,CACL,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,CAAA;AAEvB;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,QAAQ,SAAS,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC,QAKhH"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throws.d.ts","sourceRoot":"","sources":["../../ts/assertron/throws.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAG9D,wBAAgB,MAAM,CAAC,CAAC,SAAS,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;AAC1H,wBAAgB,MAAM,CAAC,CAAC,SAAS,KAAK,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,KAAK,EAAE,KAAK,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAC1H,wBAAgB,MAAM,CAAC,CAAC,SAAS,KAAK,EAAE,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AACrK,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,SAAS,CAAC,EAAE,cAAc,GAAG,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"truthy.d.ts","sourceRoot":"","sources":["../../ts/assertron/truthy.ts"],"names":[],"mappings":"AAEA,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,QAKhC"}
|
package/cjs/errors.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IsoError, ModuleError } from 'iso-error';
|
|
2
|
+
import { RequiredPick } from 'type-plus';
|
|
3
|
+
/**
|
|
4
|
+
* A base error for all assertion errors
|
|
5
|
+
*/
|
|
6
|
+
export declare class AssertionError extends ModuleError {
|
|
7
|
+
constructor(message: string, options: AssertionError.Options);
|
|
8
|
+
}
|
|
9
|
+
export declare namespace AssertionError {
|
|
10
|
+
type Options = RequiredPick<IsoError.Options, 'ssf'>;
|
|
11
|
+
}
|
|
12
|
+
export declare class FailOnOccurrence extends AssertionError {
|
|
13
|
+
occurrence: number;
|
|
14
|
+
error: any;
|
|
15
|
+
constructor(occurrence: number, error: any, options: AssertionError.Options);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../ts/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAGxC;;GAEG;AACH,qBAAa,cAAe,SAAQ,WAAW;gBACjC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,OAAO;CAG7D;AAED,yBAAiB,cAAc,CAAC;IAC9B,KAAY,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;CAC5D;AAED,qBAAa,gBAAiB,SAAQ,cAAc;IAC/B,UAAU,EAAE,MAAM;IAAS,KAAK,EAAE,GAAG;gBAArC,UAAU,EAAE,MAAM,EAAS,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,cAAc,CAAC,OAAO;CAG1F"}
|
package/cjs/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAEhD,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,eAAe,SAAS,CAAA;AACxB,OAAO,EAAE,SAAS,IAAI,CAAC,EAAE,CAAA"}
|
package/cjs/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../ts/types.ts"],"names":[],"mappings":"AACA,oBAAY,cAAc,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAA;AACpD,oBAAY,gBAAgB,CAAC,CAAC,SAAS,KAAK,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/utils/index.ts"],"names":[],"mappings":"AAEA,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAE3C,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,UAE9D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isErrorConstructor.d.ts","sourceRoot":"","sources":["../../ts/utils/isErrorConstructor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,GAAG,GAAG,SAAS,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAErF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notEqualMessage.d.ts","sourceRoot":"","sources":["../../ts/utils/notEqualMessage.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,UAEzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notSatisfiedMessage.d.ts","sourceRoot":"","sources":["../../ts/utils/notSatisfiedMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAGhC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,IAAI,EAAE,UAKlD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notThrownMessage.d.ts","sourceRoot":"","sources":["../../ts/utils/notThrownMessage.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,UAE1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promiseMessages.d.ts","sourceRoot":"","sources":["../../ts/utils/promiseMessages.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,GAAG,UAG5C;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,GAAG,UAG5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unexpectedErrorMessage.d.ts","sourceRoot":"","sources":["../../ts/utils/unexpectedErrorMessage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAG9D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,GAAG,gBAAgB,CAAC,GAAG,CAAC,UAGnG"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare class AssertOrder {
|
|
2
|
+
/**
|
|
3
|
+
* Gets the current expecting step.
|
|
4
|
+
*/
|
|
5
|
+
get currentStep(): number;
|
|
6
|
+
private state;
|
|
7
|
+
constructor(plan?: number);
|
|
8
|
+
/**
|
|
9
|
+
* Asserts the current step is `step`.
|
|
10
|
+
* @param step expected step.
|
|
11
|
+
*/
|
|
12
|
+
is(step: number): void;
|
|
13
|
+
/**
|
|
14
|
+
* Asserts the current step is not `step`.
|
|
15
|
+
* @param step not expected step.
|
|
16
|
+
*/
|
|
17
|
+
not(step: number): void;
|
|
18
|
+
/**
|
|
19
|
+
* Reset to specified step.
|
|
20
|
+
*/
|
|
21
|
+
jump(step: number): void;
|
|
22
|
+
/**
|
|
23
|
+
* Move to next step.
|
|
24
|
+
*/
|
|
25
|
+
move(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Asserts the specified step will run once.
|
|
28
|
+
*/
|
|
29
|
+
once(step: number): void;
|
|
30
|
+
on(step: number, assert: (step: number) => void): void;
|
|
31
|
+
atLeastOnce(step: number): number;
|
|
32
|
+
any(steps: number[]): number;
|
|
33
|
+
onAny(steps: number[], ...asserts: Array<(...args: any[]) => any>): void;
|
|
34
|
+
end(timeout: number): Promise<number>;
|
|
35
|
+
end(): number;
|
|
36
|
+
exactly(step: number, times: number): number;
|
|
37
|
+
wait(step: number): Promise<void>;
|
|
38
|
+
wait(step: number, callback: () => void): void;
|
|
39
|
+
private assert;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=AssertOrder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssertOrder.d.ts","sourceRoot":"","sources":["../../ts/assert-order/AssertOrder.ts"],"names":[],"mappings":"AAMA,qBAAa,WAAW;IACtB;;OAEG;IACH,IAAI,WAAW,WAEd;IAED,OAAO,CAAC,KAAK,CAAc;gBACf,IAAI,CAAC,EAAE,MAAM;IAIzB;;;OAGG;IACH,EAAE,CAAC,IAAI,EAAE,MAAM;IAIf;;;OAGG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM;IAMhB;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM;IAIjB;;OAEG;IACH,IAAI;IAIJ;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM;IAKjB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI;IAM/C,WAAW,CAAC,IAAI,EAAE,MAAM;IAaxB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE;IAQnB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;IAoBjE,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IACrC,GAAG,IAAI,MAAM;IAmBb,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAWnC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IACjC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAO9C,OAAO,CAAC,MAAM;CAKf"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AssertionError } from '../errors.js';
|
|
2
|
+
import { State } from './types.js';
|
|
3
|
+
export declare class InvalidOrder extends AssertionError {
|
|
4
|
+
state: State;
|
|
5
|
+
method: string;
|
|
6
|
+
args: any[];
|
|
7
|
+
constructor(state: State, method: string, args: any[], options: AssertionError.Options);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=InvalidOrder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvalidOrder.d.ts","sourceRoot":"","sources":["../../ts/assert-order/InvalidOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAElC,qBAAa,YAAa,SAAQ,cAAc;IAC3B,KAAK,EAAE,KAAK;IAAS,MAAM,EAAE,MAAM;IAAS,IAAI,EAAE,GAAG,EAAE;gBAAvD,KAAK,EAAE,KAAK,EAAS,MAAM,EAAE,MAAM,EAAS,IAAI,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,cAAc,CAAC,OAAO;CAG5G"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StateMachine.d.ts","sourceRoot":"","sources":["../../ts/assert-order/StateMachine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AA4ClC,qBAAa,YAAY;IACvB,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;IAMX,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;CAGb"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../ts/assert-order/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { falsy } from './falsy.js';
|
|
2
|
+
import { pathEqual } from './pathEqual.js';
|
|
3
|
+
import { rejects } from './rejects.js';
|
|
4
|
+
import { repeat } from './repeat.js';
|
|
5
|
+
import { resolves } from './resolves.js';
|
|
6
|
+
import { satisfies } from './satisfies.js';
|
|
7
|
+
import { throws } from './throws.js';
|
|
8
|
+
import { truthy } from './truthy.js';
|
|
9
|
+
export declare const assertron: {
|
|
10
|
+
false(value: any): void;
|
|
11
|
+
falsy: typeof falsy;
|
|
12
|
+
pathEqual: typeof pathEqual;
|
|
13
|
+
rejects: typeof rejects;
|
|
14
|
+
repeat: typeof repeat;
|
|
15
|
+
resolves: typeof resolves;
|
|
16
|
+
satisfies: typeof satisfies;
|
|
17
|
+
throws: typeof throws;
|
|
18
|
+
true(value: any): void;
|
|
19
|
+
truthy: typeof truthy;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=assertron.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertron.d.ts","sourceRoot":"","sources":["../../ts/assertron/assertron.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,eAAO,MAAM,SAAS;iBACP,GAAG;;;;;;;;gBAWJ,GAAG;;CAKhB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"falsy.d.ts","sourceRoot":"","sources":["../../ts/assertron/falsy.ts"],"names":[],"mappings":"AAEA,wBAAgB,KAAK,CAAC,KAAK,EAAE,GAAG,QAG/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/assertron/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
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,QAGzD"}
|
|
@@ -0,0 +1 @@
|
|
|
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,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAKlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rejects.js","sourceRoot":"","sources":["../../ts/assertron/rejects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAEtD,MAAM,UAAU,OAAO,
|
|
1
|
+
{"version":3,"file":"rejects.js","sourceRoot":"","sources":["../../ts/assertron/rejects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAEtD,MAAM,UAAU,OAAO,CAAU,OAAqB;IACpD,OAAO,OAAO,CAAC,IAAI,CACjB,KAAK,CAAC,EAAE,GAAG,MAAM,IAAI,cAAc,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAA,CAAC,CAAC,EAClF,GAAG,CAAC,EAAE,CAAC,GAAG,CACX,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repeat.d.ts","sourceRoot":"","sources":["../../ts/assertron/repeat.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAEpI"}
|
|
@@ -0,0 +1 @@
|
|
|
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,iBAK7C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { If, IsExtend, NonComposableTypes } from 'type-plus';
|
|
2
|
+
export declare type SatisfyExpectation<T> = If<IsExtend<T, string>, T | RegExp, If<IsExtend<T, NonComposableTypes>, T, If<IsExtend<T, Array<any>>, T extends Array<infer E> ? Array<SatisfyExpectation<E>> : never, {
|
|
3
|
+
[P in keyof T]?: T[P] extends string ? SatisfyExpectation<T[P]> | RegExp : SatisfyExpectation<T[P]>;
|
|
4
|
+
}>>> | ((v: T) => boolean);
|
|
5
|
+
/**
|
|
6
|
+
* Check if `actual` satisfies criteria in `expected`.
|
|
7
|
+
* @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.
|
|
8
|
+
*/
|
|
9
|
+
export declare function satisfies<Actual, Expected extends Actual>(actual: Actual, expected: SatisfyExpectation<Expected>): void;
|
|
10
|
+
//# sourceMappingURL=satisfies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"satisfies.d.ts","sourceRoot":"","sources":["../../ts/assertron/satisfies.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAI5D,oBAAY,kBAAkB,CAAC,CAAC,IAAI,EAAE,CACpC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,EACnB,CAAC,GAAG,MAAM,EACV,EAAE,CACA,QAAQ,CAAC,CAAC,EAAE,kBAAkB,CAAC,EAC/B,CAAC,EACD,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,EACxB,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,EAC/D;KACG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAClC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,GACjC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3B,CACF,CAAC,CACL,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,CAAA;AAEvB;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,QAAQ,SAAS,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC,QAKhH"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throws.d.ts","sourceRoot":"","sources":["../../ts/assertron/throws.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAG9D,wBAAgB,MAAM,CAAC,CAAC,SAAS,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;AAC1H,wBAAgB,MAAM,CAAC,CAAC,SAAS,KAAK,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,KAAK,EAAE,KAAK,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAC1H,wBAAgB,MAAM,CAAC,CAAC,SAAS,KAAK,EAAE,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AACrK,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,SAAS,CAAC,EAAE,cAAc,GAAG,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"truthy.d.ts","sourceRoot":"","sources":["../../ts/assertron/truthy.ts"],"names":[],"mappings":"AAEA,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,QAKhC"}
|
package/esm/errors.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IsoError, ModuleError } from 'iso-error';
|
|
2
|
+
import { RequiredPick } from 'type-plus';
|
|
3
|
+
/**
|
|
4
|
+
* A base error for all assertion errors
|
|
5
|
+
*/
|
|
6
|
+
export declare class AssertionError extends ModuleError {
|
|
7
|
+
constructor(message: string, options: AssertionError.Options);
|
|
8
|
+
}
|
|
9
|
+
export declare namespace AssertionError {
|
|
10
|
+
type Options = RequiredPick<IsoError.Options, 'ssf'>;
|
|
11
|
+
}
|
|
12
|
+
export declare class FailOnOccurrence extends AssertionError {
|
|
13
|
+
occurrence: number;
|
|
14
|
+
error: any;
|
|
15
|
+
constructor(occurrence: number, error: any, options: AssertionError.Options);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../ts/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAGxC;;GAEG;AACH,qBAAa,cAAe,SAAQ,WAAW;gBACjC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,OAAO;CAG7D;AAED,yBAAiB,cAAc,CAAC;IAC9B,KAAY,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;CAC5D;AAED,qBAAa,gBAAiB,SAAQ,cAAc;IAC/B,UAAU,EAAE,MAAM;IAAS,KAAK,EAAE,GAAG;gBAArC,UAAU,EAAE,MAAM,EAAS,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,cAAc,CAAC,OAAO;CAG1F"}
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAEhD,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,eAAe,SAAS,CAAA;AACxB,OAAO,EAAE,SAAS,IAAI,CAAC,EAAE,CAAA"}
|
package/esm/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../ts/types.ts"],"names":[],"mappings":"AACA,oBAAY,cAAc,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAA;AACpD,oBAAY,gBAAgB,CAAC,CAAC,SAAS,KAAK,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/utils/index.ts"],"names":[],"mappings":"AAEA,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAE3C,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,UAE9D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isErrorConstructor.d.ts","sourceRoot":"","sources":["../../ts/utils/isErrorConstructor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,GAAG,GAAG,SAAS,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAErF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notEqualMessage.d.ts","sourceRoot":"","sources":["../../ts/utils/notEqualMessage.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,UAEzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notSatisfiedMessage.d.ts","sourceRoot":"","sources":["../../ts/utils/notSatisfiedMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAGhC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,IAAI,EAAE,UAKlD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notThrownMessage.d.ts","sourceRoot":"","sources":["../../ts/utils/notThrownMessage.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,UAE1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promiseMessages.d.ts","sourceRoot":"","sources":["../../ts/utils/promiseMessages.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,GAAG,UAG5C;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,GAAG,UAG5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unexpectedErrorMessage.d.ts","sourceRoot":"","sources":["../../ts/utils/unexpectedErrorMessage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAG9D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,GAAG,gBAAgB,CAAC,GAAG,CAAC,UAGnG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assertron",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.3",
|
|
4
4
|
"description": "A supplementary assertion library",
|
|
5
5
|
"homepage": "https://github.com/unional/assertron",
|
|
6
6
|
"bugs": {
|
|
@@ -48,32 +48,32 @@
|
|
|
48
48
|
"size": "size-limit",
|
|
49
49
|
"test": "jest",
|
|
50
50
|
"test:watch": "jest --watch",
|
|
51
|
-
"
|
|
51
|
+
"test:type": "tsc",
|
|
52
|
+
"verify": "npm-run-all clean -p build test:type depcheck lint coverage -p size",
|
|
52
53
|
"watch": "yarn test:watch"
|
|
53
54
|
},
|
|
54
55
|
"dependencies": {
|
|
55
56
|
"is-node": "^1.0.2",
|
|
56
57
|
"is-promise": "^4.0.0",
|
|
57
58
|
"iso-error": "^4.3.3",
|
|
58
|
-
"path-equal": "^1.1
|
|
59
|
-
"satisfier": "^5.
|
|
60
|
-
"tersify": "^3.
|
|
59
|
+
"path-equal": "^1.2.1",
|
|
60
|
+
"satisfier": "^5.2.0",
|
|
61
|
+
"tersify": "^3.10.0",
|
|
61
62
|
"type-plus": "^4.9.1"
|
|
62
63
|
},
|
|
63
64
|
"devDependencies": {
|
|
64
|
-
"@commitlint/cli": "^17.0.
|
|
65
|
-
"@commitlint/config-conventional": "^17.0.
|
|
65
|
+
"@commitlint/cli": "^17.0.2",
|
|
66
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
66
67
|
"@semantic-release/changelog": "^6.0.1",
|
|
67
68
|
"@semantic-release/git": "^10.0.1",
|
|
68
69
|
"@semantic-release/github": "^8.0.4",
|
|
69
70
|
"@size-limit/preset-small-lib": "^7.0.8",
|
|
70
|
-
"@types/jest": "^
|
|
71
|
-
"@types/lodash": "^4.14.
|
|
72
|
-
"@types/node": "^17.0.
|
|
73
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
74
|
-
"@typescript-eslint/parser": "^5.23.0",
|
|
71
|
+
"@types/jest": "^28.1.1",
|
|
72
|
+
"@types/lodash": "^4.14.182",
|
|
73
|
+
"@types/node": "^17.0.39",
|
|
74
|
+
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
|
75
75
|
"depcheck": "^1.4.3",
|
|
76
|
-
"eslint": "^8.
|
|
76
|
+
"eslint": "^8.17.0",
|
|
77
77
|
"eslint-config-prettier": "^8.5.0",
|
|
78
78
|
"eslint-plugin-harmony": "^7.1.0",
|
|
79
79
|
"husky": "^8.0.1",
|
|
@@ -88,11 +88,15 @@
|
|
|
88
88
|
"rimraf": "^3.0.2",
|
|
89
89
|
"semantic-release": "^19.0.2",
|
|
90
90
|
"size-limit": "^7.0.8",
|
|
91
|
-
"ts-jest": "^28.0.
|
|
92
|
-
"typescript": "^4.7.
|
|
91
|
+
"ts-jest": "^28.0.4",
|
|
92
|
+
"typescript": "^4.7.3"
|
|
93
93
|
},
|
|
94
94
|
"packageManager": "yarn@3.2.1",
|
|
95
95
|
"size-limit": [
|
|
96
|
+
{
|
|
97
|
+
"path": "./cjs/index.js",
|
|
98
|
+
"limit": "15 KB"
|
|
99
|
+
},
|
|
96
100
|
{
|
|
97
101
|
"path": "./esm/index.js",
|
|
98
102
|
"limit": "10 KB"
|
package/ts/assertron/rejects.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AssertionError } from '../errors.js'
|
|
2
2
|
import { notRejectedMessage } from '../utils/index.js'
|
|
3
3
|
|
|
4
|
-
export function rejects(promise: Promise<any>) {
|
|
4
|
+
export function rejects<R = any>(promise: Promise<any>): Promise<R> {
|
|
5
5
|
return promise.then(
|
|
6
6
|
value => { throw new AssertionError(notRejectedMessage(value), { ssf: rejects }) },
|
|
7
7
|
err => err
|