assertron 9.1.0 → 9.2.2
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 +33 -57
- 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 +1 -1
- 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/index.js +2 -0
- package/cjs/index.js.map +1 -1
- 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 +1 -1
- 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/index.js +1 -0
- package/esm/index.js.map +1 -1
- 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 +1 -1
- package/ts/assertron/rejects.ts +2 -2
- package/ts/index.ts +1 -0
package/README.md
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
<!-- markdownlint-disable MD024 -->
|
|
2
|
-
|
|
3
1
|
# assertron
|
|
4
2
|
|
|
5
3
|
[![NPM version][npm-image]][npm-url]
|
|
6
4
|
[![NPM downloads][downloads-image]][downloads-url]
|
|
7
5
|
|
|
8
|
-
[![
|
|
6
|
+
[![GitHub NodeJS][github-nodejs]][github-action-url]
|
|
9
7
|
[![Codecov][codecov-image]][codecov-url]
|
|
10
|
-
[![Coverage Status][coveralls-image]][coveralls-url]
|
|
11
8
|
|
|
12
9
|
[![Semantic Release][semantic-release-image]][semantic-release-url]
|
|
13
10
|
|
|
@@ -15,41 +12,37 @@
|
|
|
15
12
|
|
|
16
13
|
A supplementary assertion library that runs on both NodeJS and browser.
|
|
17
14
|
|
|
18
|
-
##
|
|
19
|
-
|
|
20
|
-
`assertron` provides a collection of assertion methods.
|
|
21
|
-
|
|
22
|
-
### assertron.false(value)
|
|
23
|
-
|
|
24
|
-
Asserts the provided value is false.
|
|
25
|
-
|
|
26
|
-
### assertron.falsy(value)
|
|
15
|
+
## Install
|
|
27
16
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Asserts the two paths are equal regardless of operating system differences.
|
|
33
|
-
|
|
34
|
-
### assertron.rejects(promise)
|
|
35
|
-
|
|
36
|
-
Asserts the promise rejects.
|
|
17
|
+
```sh
|
|
18
|
+
# npm
|
|
19
|
+
npm install assertron
|
|
37
20
|
|
|
38
|
-
|
|
21
|
+
# yarn
|
|
22
|
+
yarn add assertron
|
|
39
23
|
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
# pnpm
|
|
25
|
+
pnpm install assertron
|
|
42
26
|
|
|
43
|
-
|
|
27
|
+
#rush
|
|
28
|
+
rush add -p assertron
|
|
29
|
+
```
|
|
44
30
|
|
|
45
|
-
|
|
31
|
+
## Usage
|
|
46
32
|
|
|
47
|
-
|
|
33
|
+
`assertron` provides a collection of assertion methods:
|
|
48
34
|
|
|
49
|
-
`assertron.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
35
|
+
- `assertron.false(value)`: asserts the provided value is false.
|
|
36
|
+
- `assertron.falsy(value)`: asserts the provided value is falsy.
|
|
37
|
+
- `assertron.pathEqual(actual, expected)`: asserts the two paths are equal regardless of operating system differences.
|
|
38
|
+
- `assertron.rejects(promise)`: asserts the promise rejects.
|
|
39
|
+
- `assertron.repeat(fn, times)`: repeat the specified function n times and return the last result.\
|
|
40
|
+
If the result is a promise, it will run the function sequentially.
|
|
41
|
+
- `assertron.resolves(promise)`: asserts the promise resolves.
|
|
42
|
+
- `assertron.satisfies(actual, expected)`: checks if `actual` meets the requirements specified by `expected`.\
|
|
43
|
+
Each property in `expected` can be a value, a `RegExp`, or a predicate function.\
|
|
44
|
+
It uses `satisfier` internally to check for validity.\
|
|
45
|
+
Check out [`satisfier`](https://github.com/unional/satisfier) for more detail.
|
|
53
46
|
|
|
54
47
|
```ts
|
|
55
48
|
import a from 'assertron' // assertron is also exported as default.
|
|
@@ -66,9 +59,7 @@ a.satisfies({ a: 'foo' }, { a: /boo/ })
|
|
|
66
59
|
a.satisfies({ a: 1 }, { a: () => false })
|
|
67
60
|
```
|
|
68
61
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
Asserts the promise, function, or async function throws (or rejects) an error.
|
|
62
|
+
- `assertron.throws(...)`: asserts the promise, function, or async function throws (or rejects) an error.
|
|
72
63
|
|
|
73
64
|
```ts
|
|
74
65
|
import { assertron } from 'assertron'
|
|
@@ -82,21 +73,14 @@ const e2 = assertron.throws(() => { throw new SpecificError('foo') }, SpecificEr
|
|
|
82
73
|
const e3 = await assertron.throws(() => Promise.reject(new SpecificError('foo')), SpecificError)
|
|
83
74
|
```
|
|
84
75
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
Asserts the provided value is true.
|
|
88
|
-
|
|
89
|
-
### assertron.truthy(value)
|
|
90
|
-
|
|
91
|
-
Asserts the provided value is truthy.
|
|
76
|
+
- `assertron.true(value)`: asserts the provided value is true.
|
|
77
|
+
- `assertron.truthy(value)`: asserts the provided value is truthy.
|
|
92
78
|
|
|
93
79
|
## AssertOrder
|
|
94
80
|
|
|
95
81
|
Assert the code is executed in the expected order.
|
|
96
82
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
Asserts the step `step` executed once.
|
|
83
|
+
- `order.once(step: number)`: asserts the step `step` executed once.
|
|
100
84
|
|
|
101
85
|
```ts
|
|
102
86
|
import { AssertOrder } from 'assertron'
|
|
@@ -126,9 +110,7 @@ foo()
|
|
|
126
110
|
boo()
|
|
127
111
|
```
|
|
128
112
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
Assert the `step` executed at least once.
|
|
113
|
+
- `order.atLeastOnce(step: number)`: assert the `step` executed at least once.
|
|
132
114
|
|
|
133
115
|
```ts
|
|
134
116
|
import { AssertOrder } from 'assertron'
|
|
@@ -142,9 +124,7 @@ for (let i = 0; i < 10; i++)
|
|
|
142
124
|
o.once(2)
|
|
143
125
|
```
|
|
144
126
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
Asserts the step `step` executed exactly n times
|
|
127
|
+
- `order.exactly(step: number, times: number)`: asserts the step `step` executed exactly n times
|
|
148
128
|
|
|
149
129
|
```ts
|
|
150
130
|
import { AssertOrder } from 'assertron'
|
|
@@ -155,9 +135,7 @@ for (let i = 0; i < 4; i++)
|
|
|
155
135
|
o.exactly(1, 3) // throws at i === 3
|
|
156
136
|
```
|
|
157
137
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
Asserts any of the steps `steps` executed.
|
|
138
|
+
- `order.any(steps: number[])`: asserts any of the steps `steps` executed.
|
|
161
139
|
|
|
162
140
|
```ts
|
|
163
141
|
import { AssertOrder } from 'assertron'
|
|
@@ -190,7 +168,7 @@ git push
|
|
|
190
168
|
# create PR
|
|
191
169
|
```
|
|
192
170
|
|
|
193
|
-
##
|
|
171
|
+
## NPM Commands
|
|
194
172
|
|
|
195
173
|
There are a few useful commands you can use during development.
|
|
196
174
|
|
|
@@ -211,8 +189,6 @@ yarn verify
|
|
|
211
189
|
[github-action-url]: https://github.com/unional/assertron/actions
|
|
212
190
|
[codecov-image]: https://codecov.io/gh/unional/assertron/branch/master/graph/badge.svg
|
|
213
191
|
[codecov-url]: https://codecov.io/gh/unional/assertron
|
|
214
|
-
[coveralls-image]: https://coveralls.io/repos/github/unional/assertron/badge.svg
|
|
215
|
-
[coveralls-url]: https://coveralls.io/github/unional/assertron
|
|
216
192
|
|
|
217
193
|
[semantic-release-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
|
|
218
194
|
[semantic-release-url]: https://github.com/semantic-release/semantic-release
|
|
@@ -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"}
|
package/cjs/assertron/rejects.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.rejects = void 0;
|
|
|
4
4
|
var errors_js_1 = require("../errors.js");
|
|
5
5
|
var index_js_1 = require("../utils/index.js");
|
|
6
6
|
function rejects(promise) {
|
|
7
|
-
return promise.then(function (value) { throw new errors_js_1.AssertionError((0, index_js_1.notRejectedMessage)(value), { ssf: rejects }); }, function () { });
|
|
7
|
+
return promise.then(function (value) { throw new errors_js_1.AssertionError((0, index_js_1.notRejectedMessage)(value), { ssf: rejects }); }, function (err) { return 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,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/index.js
CHANGED
|
@@ -14,7 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.a = void 0;
|
|
17
18
|
var index_js_1 = require("./assertron/index.js");
|
|
19
|
+
Object.defineProperty(exports, "a", { enumerable: true, get: function () { return index_js_1.assertron; } });
|
|
18
20
|
__exportStar(require("./assert-order/index.js"), exports);
|
|
19
21
|
__exportStar(require("./assertron/index.js"), exports);
|
|
20
22
|
__exportStar(require("./errors.js"), exports);
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAAgD;AAM1B,kFANb,oBAAS,OAMK;AAJvB,0DAAuC;AACvC,uDAAoC;AACpC,8CAA2B;AAC3B,kBAAe,oBAAS,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"}
|
package/esm/assertron/rejects.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AssertionError } from '../errors.js';
|
|
2
2
|
import { notRejectedMessage } from '../utils/index.js';
|
|
3
3
|
export function rejects(promise) {
|
|
4
|
-
return promise.then(value => { throw new AssertionError(notRejectedMessage(value), { ssf: rejects }); },
|
|
4
|
+
return promise.then(value => { throw new AssertionError(notRejectedMessage(value), { ssf: rejects }); }, err => err);
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=rejects.js.map
|
|
@@ -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/index.js
CHANGED
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","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"}
|
|
1
|
+
{"version":3,"file":"index.js","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
package/ts/assertron/rejects.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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
|
|
8
8
|
)
|
|
9
9
|
}
|
package/ts/index.ts
CHANGED