@orkestrel/test 0.0.11 → 0.0.13
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 +58 -39
- package/dist/src/browser/index.d.ts +516 -268
- package/dist/src/browser/index.js +363 -89
- package/dist/src/browser/index.js.map +1 -1
- package/dist/src/core/index.cjs +191 -23
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +272 -23
- package/dist/src/core/index.d.ts +272 -23
- package/dist/src/core/index.js +185 -24
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +69 -50
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +74 -36
- package/dist/src/server/index.d.ts +74 -36
- package/dist/src/server/index.js +68 -52
- package/dist/src/server/index.js.map +1 -1
- package/package.json +14 -11
package/dist/src/core/index.d.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the error {@link retryUntil} raises when its elapsed-time budget runs out.
|
|
3
|
+
*
|
|
4
|
+
* @param description - The operation the retry was named for.
|
|
5
|
+
* @param budget - The elapsed-time limit in milliseconds.
|
|
6
|
+
* @param elapsed - The milliseconds the retry actually spent.
|
|
7
|
+
* @param last - The rendered last unsatisfying value, or `undefined` when the retry produced none.
|
|
8
|
+
* @param cause - The last producer error, which becomes the returned error's `cause`.
|
|
9
|
+
* @returns The exhaustion error, unthrown.
|
|
10
|
+
* @remarks Both of `retryUntil`'s elapsed checks raise this one message, so an edit to it lands in
|
|
11
|
+
* one place. The rendered value is appended only when the retry produced one.
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildRetryExhausted(description: string, budget: number, elapsed: number, last: string | undefined, cause: unknown): Error;
|
|
14
|
+
|
|
1
15
|
/**
|
|
2
16
|
* Captures the value thrown by a thunk.
|
|
3
17
|
*
|
|
@@ -6,6 +20,19 @@
|
|
|
6
20
|
*/
|
|
7
21
|
export declare function captureError(thunk: () => unknown): unknown;
|
|
8
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Checks the resolved bounds one bounded wait runs under.
|
|
25
|
+
*
|
|
26
|
+
* @param subject - The bound's owner, which opens each refusal message.
|
|
27
|
+
* @param budget - The resolved elapsed-time limit in milliseconds.
|
|
28
|
+
* @param interval - The resolved delay between readings in milliseconds.
|
|
29
|
+
* @throws An `Error` reading `<subject> budget must be finite and non-negative` or
|
|
30
|
+
* `<subject> interval must be finite and non-negative`.
|
|
31
|
+
* @remarks Every member of the wait family resolves its own defaults first and passes the resolved
|
|
32
|
+
* numbers here, so each keeps its own defaults while one contract states what a bound must be.
|
|
33
|
+
*/
|
|
34
|
+
export declare function checkBounds(subject: string, budget: number, interval: number): void;
|
|
35
|
+
|
|
9
36
|
/**
|
|
10
37
|
* Collects every value from an async iterable.
|
|
11
38
|
*
|
|
@@ -133,6 +160,18 @@ export declare function createTeardown(): TeardownInterface;
|
|
|
133
160
|
*/
|
|
134
161
|
export declare function decodeJSONLines(text: string): readonly unknown[];
|
|
135
162
|
|
|
163
|
+
/**
|
|
164
|
+
* Drops the registration an instrumented signal installed for one listener.
|
|
165
|
+
*
|
|
166
|
+
* @param registrations - The live registration list, spliced in place.
|
|
167
|
+
* @param installed - The installed listener naming the registration to drop.
|
|
168
|
+
* @returns The dropped registration, or `undefined` when the list holds none for that listener.
|
|
169
|
+
* @remarks The dropped registration's cleanup controller is aborted as it leaves, so the scope
|
|
170
|
+
* subscription installed beside it leaves with it. Removing the installed listener from the signal
|
|
171
|
+
* stays with the caller, because only the scope-abort path has one to remove.
|
|
172
|
+
*/
|
|
173
|
+
export declare function dropRegistration(registrations: SignalRegistration[], installed: EventListener | EventListenerObject): SignalRegistration | undefined;
|
|
174
|
+
|
|
136
175
|
/**
|
|
137
176
|
* Subscribes handlers to a typed event source.
|
|
138
177
|
*
|
|
@@ -157,6 +196,73 @@ export declare interface EventSourceInterface<TMap extends Record<string, readon
|
|
|
157
196
|
*/
|
|
158
197
|
export declare type EventSubscriber<TArgs extends readonly unknown[]> = (listener: (...args: TArgs) => void) => (() => void) | void;
|
|
159
198
|
|
|
199
|
+
/**
|
|
200
|
+
* Drives one statechart scenario through its arrange, act, and assert phases.
|
|
201
|
+
*
|
|
202
|
+
* @typeParam TState - The states the entity moves between.
|
|
203
|
+
* @typeParam TEvent - The events the entity accepts.
|
|
204
|
+
* @typeParam TContext - The fixture the phases drive.
|
|
205
|
+
* @param scenario - The scenario to drive.
|
|
206
|
+
* @param context - The fixture handed to each phase.
|
|
207
|
+
* @returns A promise that resolves after the assert phase completes.
|
|
208
|
+
* @throws An `Error` whose message opens with the transition's `name` and whose `cause` is the value
|
|
209
|
+
* the failing phase threw.
|
|
210
|
+
* @remarks Each phase is awaited before the next begins, so an asynchronous arrange settles before
|
|
211
|
+
* the event is applied. The phases receive the transition's own parts: `arrange` receives `from`,
|
|
212
|
+
* `act` receives `event`, and `assert` receives `to`.
|
|
213
|
+
*
|
|
214
|
+
* The row's name is prepended because a table's rows run under one test name, so a bare assertion
|
|
215
|
+
* message says what failed and never which row. A thrown `Error` keeps its own message after the
|
|
216
|
+
* name and arrives as the `cause`; anything else thrown is named by its type and arrives as the
|
|
217
|
+
* `cause` unchanged.
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```ts
|
|
221
|
+
* await executeScenario(scenarios[0], { disclosure: new Disclosure() })
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
export declare function executeScenario<TState extends string, TEvent extends string, TContext>(scenario: StateScenario<TState, TEvent, TContext>, context: TContext): Promise<void>;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Drives a statechart table row by row, each row against a context of its own.
|
|
228
|
+
*
|
|
229
|
+
* @typeParam TState - The states the entity moves between.
|
|
230
|
+
* @typeParam TEvent - The events the entity accepts.
|
|
231
|
+
* @typeParam TContext - The fixture the phases drive.
|
|
232
|
+
* @param scenarios - The table to drive, in the order it is written.
|
|
233
|
+
* @param build - The fixture builder, called once per row and awaited when it returns a promise.
|
|
234
|
+
* @returns A promise that resolves after the last row completes.
|
|
235
|
+
* @throws An `Error` reading `<name>: build refused` when the row's builder throws or rejects, whose
|
|
236
|
+
* `cause` is the value the builder refused with, or whatever {@link executeScenario} throws for the
|
|
237
|
+
* first row whose phases fail. Either way the run stops at that row and the rows after it never
|
|
238
|
+
* start.
|
|
239
|
+
* @remarks The rows run one after another rather than together: a statechart's rows drive one
|
|
240
|
+
* entity on one page, so a parallel run would have them arranging over each other. `build` receives
|
|
241
|
+
* the row it is building for, which is what lets one table mix fixtures.
|
|
242
|
+
*
|
|
243
|
+
* A refusing builder is named for its row the way a failing phase is, because a table's rows build
|
|
244
|
+
* under one test name too. The refusal itself arrives as the `cause`, by identity, so its own
|
|
245
|
+
* message and stack survive the naming.
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```ts
|
|
249
|
+
* await executeScenarios(SCENARIOS, () => ({ disclosure: new Disclosure() }))
|
|
250
|
+
* ```
|
|
251
|
+
*/
|
|
252
|
+
export declare function executeScenarios<TState extends string, TEvent extends string, TContext>(scenarios: ReadonlyArray<StateScenario<TState, TEvent, TContext>>, build: (scenario: StateScenario<TState, TEvent, TContext>) => TContext | Promise<TContext>): Promise<void>;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Represents one operation that raised a failure instead of producing a value.
|
|
256
|
+
*
|
|
257
|
+
* @typeParam E - The failure type.
|
|
258
|
+
*/
|
|
259
|
+
export declare interface Failure<E> {
|
|
260
|
+
/** Holds the discriminant that names the failed arm. */
|
|
261
|
+
readonly success: false;
|
|
262
|
+
/** Holds the failure the operation raised. */
|
|
263
|
+
readonly error: E;
|
|
264
|
+
}
|
|
265
|
+
|
|
160
266
|
/**
|
|
161
267
|
* Normalizes headers into a frozen plain record.
|
|
162
268
|
*
|
|
@@ -168,7 +274,7 @@ export declare type EventSubscriber<TArgs extends readonly unknown[]> = (listene
|
|
|
168
274
|
export declare function flattenHeaders(init: HeadersSource): Readonly<Record<string, string>>;
|
|
169
275
|
|
|
170
276
|
/**
|
|
171
|
-
*
|
|
277
|
+
* Covers any value the host `Headers` constructor accepts.
|
|
172
278
|
*
|
|
173
279
|
* @remarks Derived from the host constructor rather than named from a single library, so the type
|
|
174
280
|
* resolves in every project against that project's own `Headers` declaration. The record,
|
|
@@ -206,8 +312,8 @@ export declare function invokeUnchecked<T>(target: unknown, method: unknown, arg
|
|
|
206
312
|
export declare function isRecorderMapComplete<TMap extends Record<string, readonly unknown[]>, TName extends keyof TMap>(value: unknown, events: readonly TName[]): value is RecorderMap<TMap, TName>;
|
|
207
313
|
|
|
208
314
|
/**
|
|
209
|
-
*
|
|
210
|
-
* member it does not, mapped to `never`.
|
|
315
|
+
* Represents the JSON-safe projection of a type: every member JSON preserves, mapped to itself, and
|
|
316
|
+
* every member it does not, mapped to `never`.
|
|
211
317
|
*
|
|
212
318
|
* @typeParam T - The type to project.
|
|
213
319
|
* @remarks Intersect a parameter with this rather than constraining it to `JSONValue`. A `JSONValue`
|
|
@@ -238,7 +344,7 @@ export declare type JSONSafe<T> = unknown extends T ? T : T extends string | num
|
|
|
238
344
|
readonly [K in keyof T]: K extends symbol ? never : JSONSafe<T[K]>;
|
|
239
345
|
} : never;
|
|
240
346
|
|
|
241
|
-
/**
|
|
347
|
+
/** Covers any value JSON can represent, so a round trip through JSON preserves the type. */
|
|
242
348
|
export declare type JSONValue = string | number | boolean | null | readonly JSONValue[] | {
|
|
243
349
|
readonly [key: string]: JSONValue;
|
|
244
350
|
};
|
|
@@ -262,11 +368,11 @@ export declare function readProperty<T>(target: unknown, key: PropertyKey): T;
|
|
|
262
368
|
* @typeParam TArgs - The argument tuple the recorded handler accepts.
|
|
263
369
|
*/
|
|
264
370
|
export declare interface RecorderInterface<TArgs extends readonly unknown[]> {
|
|
265
|
-
/**
|
|
371
|
+
/** Lists every recorded call, oldest first, each entry the arguments of one call. */
|
|
266
372
|
readonly calls: readonly TArgs[];
|
|
267
|
-
/**
|
|
373
|
+
/** Reports how many calls have been recorded. */
|
|
268
374
|
readonly count: number;
|
|
269
|
-
/**
|
|
375
|
+
/** Holds the callback to hand to the code under test. */
|
|
270
376
|
readonly handler: (...args: TArgs) => void;
|
|
271
377
|
/** Discards the recorded calls and keeps the recorder usable. */
|
|
272
378
|
clear(): void;
|
|
@@ -287,7 +393,7 @@ export declare type RecorderMap<TMap extends Record<string, readonly unknown[]>,
|
|
|
287
393
|
*
|
|
288
394
|
* @typeParam T - The required value type.
|
|
289
395
|
* @param value - The value to check.
|
|
290
|
-
* @param message - The error message used when the value is absent.
|
|
396
|
+
* @param message - The error message used when the value is absent. Default: `'Value is required'`.
|
|
291
397
|
* @returns The present value.
|
|
292
398
|
*/
|
|
293
399
|
export declare function requireValue<T>(value: T | null | undefined, message?: string): T;
|
|
@@ -301,11 +407,11 @@ export declare function requireValue<T>(value: T | null | undefined, message?: s
|
|
|
301
407
|
*/
|
|
302
408
|
export declare function resolveRoot(meta: ImportMeta): URL;
|
|
303
409
|
|
|
304
|
-
/**
|
|
410
|
+
/** Represents a numbered resource factory with records of every creation and destruction. */
|
|
305
411
|
export declare interface ResourceFactoryInterface {
|
|
306
|
-
/**
|
|
412
|
+
/** Records the ids returned by `create`, in order. */
|
|
307
413
|
readonly created: RecorderInterface<readonly [id: number]>;
|
|
308
|
-
/**
|
|
414
|
+
/** Records the ids passed to `destroy`, in order. */
|
|
309
415
|
readonly destroyed: RecorderInterface<readonly [id: number]>;
|
|
310
416
|
/**
|
|
311
417
|
* Creates a numbered resource.
|
|
@@ -321,9 +427,20 @@ export declare interface ResourceFactoryInterface {
|
|
|
321
427
|
destroy(id: number): void;
|
|
322
428
|
}
|
|
323
429
|
|
|
430
|
+
/**
|
|
431
|
+
* Represents the outcome of one operation: the value it produced, or the failure it raised.
|
|
432
|
+
*
|
|
433
|
+
* @typeParam T - The produced value type.
|
|
434
|
+
* @typeParam E - The failure type. Defaults to `Error`.
|
|
435
|
+
* @remarks `success` is the discriminant, so a caller narrows on it before reading `value` or
|
|
436
|
+
* `error`. This package declares no runtime dependency, so this is the one outcome contract its own
|
|
437
|
+
* members read rather than an anonymous union written at each call site.
|
|
438
|
+
*/
|
|
439
|
+
export declare type Result<T, E = Error> = Success<T> | Failure<E>;
|
|
440
|
+
|
|
324
441
|
/** Configures a bounded retry. */
|
|
325
442
|
export declare interface RetryOptions extends WaitOptions {
|
|
326
|
-
/**
|
|
443
|
+
/** Caps the number of producer calls. When omitted, only the time budget bounds the retry. */
|
|
327
444
|
readonly attempts?: number;
|
|
328
445
|
}
|
|
329
446
|
|
|
@@ -356,22 +473,154 @@ export declare function retryUntil<T>(description: string, produce: () => T | Pr
|
|
|
356
473
|
*/
|
|
357
474
|
export declare function roundTripJSON<T>(value: T & JSONSafe<T>): T;
|
|
358
475
|
|
|
359
|
-
/**
|
|
476
|
+
/** Holds a real abort signal and controller instrumented with its live abort-listener tally. */
|
|
360
477
|
export declare interface SignalInterface {
|
|
361
|
-
/**
|
|
478
|
+
/** Holds the controller that owns the signal. */
|
|
362
479
|
readonly controller: AbortController;
|
|
363
|
-
/**
|
|
480
|
+
/** Holds the signal to hand to the code under test. */
|
|
364
481
|
readonly signal: AbortSignal;
|
|
365
|
-
/**
|
|
482
|
+
/** Reports the live abort-listener tally. */
|
|
366
483
|
readonly count: number;
|
|
367
484
|
}
|
|
368
485
|
|
|
369
|
-
/**
|
|
486
|
+
/**
|
|
487
|
+
* Represents one abort listener an instrumented signal installed, as its tally holds it.
|
|
488
|
+
*
|
|
489
|
+
* @remarks The members are the listener the caller supplied, the listener installed in its place,
|
|
490
|
+
* the capture flag the pair was registered under, and the controller that removes the scope
|
|
491
|
+
* subscription installed beside it, which is `undefined` where no other signal scopes the
|
|
492
|
+
* registration.
|
|
493
|
+
*/
|
|
494
|
+
export declare type SignalRegistration = readonly [
|
|
495
|
+
listener: EventListener | EventListenerObject,
|
|
496
|
+
installed: EventListener | EventListenerObject,
|
|
497
|
+
capture: boolean,
|
|
498
|
+
cleanup: AbortController | undefined
|
|
499
|
+
];
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Names the attributes a statechart harness publishes, keyed by the fact each one carries.
|
|
503
|
+
*
|
|
504
|
+
* @remarks
|
|
505
|
+
* A harness renders its own table and a gate outside the page polls the rendered markup, so these
|
|
506
|
+
* names are the whole contract between the two. `status`, `passed`, `failed`, and `total` belong on
|
|
507
|
+
* the harness root, because a gate finds the harness by `status` and reads the tally from the same
|
|
508
|
+
* element. `scenario` and `result` belong on each row, so a failing row is found by `result` and
|
|
509
|
+
* named by `scenario`. `state` belongs on the element rendering the entity's current state.
|
|
510
|
+
*
|
|
511
|
+
* The values are the attribute names themselves, so a harness writes `setAttribute` against this map
|
|
512
|
+
* and a gate writes `querySelector` against it, and neither spells a `data-statechart-*` string of
|
|
513
|
+
* its own.
|
|
514
|
+
*
|
|
515
|
+
* @example
|
|
516
|
+
* ```ts
|
|
517
|
+
* harness.getAttribute(STATECHART_ATTRIBUTES.status) // 'passed'
|
|
518
|
+
* ```
|
|
519
|
+
*/
|
|
520
|
+
export declare const STATECHART_ATTRIBUTES: Readonly<{
|
|
521
|
+
status: "data-statechart-status";
|
|
522
|
+
passed: "data-statechart-passed";
|
|
523
|
+
failed: "data-statechart-failed";
|
|
524
|
+
total: "data-statechart-total";
|
|
525
|
+
scenario: "data-statechart-scenario";
|
|
526
|
+
result: "data-statechart-result";
|
|
527
|
+
state: "data-statechart-state";
|
|
528
|
+
}>;
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Lists every value a statechart harness reports through its `status` attribute.
|
|
532
|
+
*
|
|
533
|
+
* @remarks
|
|
534
|
+
* `pending` is what a harness carries before a run has produced a result for every row, `idle` is a
|
|
535
|
+
* harness standing ready with nothing running, and `running` is a run in flight. `passed` and
|
|
536
|
+
* `failed` are the two terminal readings, so a gate waits for membership in that pair rather than
|
|
537
|
+
* for a fixed duration.
|
|
538
|
+
*
|
|
539
|
+
* The tuple's order is the order a run passes through, and its element type is the literal union, so
|
|
540
|
+
* `(typeof STATECHART_STATUSES)[number]` is the status type a harness and its gate share.
|
|
541
|
+
*
|
|
542
|
+
* @example
|
|
543
|
+
* ```ts
|
|
544
|
+
* const terminal = new Set<string>([STATECHART_STATUSES[3], STATECHART_STATUSES[4]])
|
|
545
|
+
* ```
|
|
546
|
+
*/
|
|
547
|
+
export declare const STATECHART_STATUSES: readonly ["pending", "idle", "running", "passed", "failed"];
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Drives one {@link StateTransition} through the three phases that prove it.
|
|
551
|
+
*
|
|
552
|
+
* @typeParam TState - The states the entity moves between, as a string-literal union.
|
|
553
|
+
* @typeParam TEvent - The events the entity accepts, as a string-literal union.
|
|
554
|
+
* @typeParam TContext - The fixture the three phases drive.
|
|
555
|
+
* @remarks Each phase receives the context and the part of the transition it is responsible for, so
|
|
556
|
+
* a phase reads its subject from its own parameters rather than from the row it belongs to. A phase
|
|
557
|
+
* may be synchronous or asynchronous, and `executeScenario` awaits each one before starting the
|
|
558
|
+
* next.
|
|
559
|
+
*/
|
|
560
|
+
export declare interface StateScenario<TState extends string, TEvent extends string, TContext> {
|
|
561
|
+
/** Holds the row this scenario drives. */
|
|
562
|
+
readonly transition: StateTransition<TState, TEvent>;
|
|
563
|
+
/**
|
|
564
|
+
* Puts the entity into the transition's `from` state.
|
|
565
|
+
*
|
|
566
|
+
* @param context - The fixture this row drives.
|
|
567
|
+
* @param state - The transition's `from` state.
|
|
568
|
+
*/
|
|
569
|
+
arrange(context: TContext, state: TState): Promise<void> | void;
|
|
570
|
+
/**
|
|
571
|
+
* Applies the transition's event to the arranged entity.
|
|
572
|
+
*
|
|
573
|
+
* @param context - The fixture this row drives.
|
|
574
|
+
* @param event - The transition's event.
|
|
575
|
+
*/
|
|
576
|
+
act(context: TContext, event: TEvent): Promise<void> | void;
|
|
577
|
+
/**
|
|
578
|
+
* Checks that the entity reached the transition's `to` state.
|
|
579
|
+
*
|
|
580
|
+
* @param context - The fixture this row drives.
|
|
581
|
+
* @param state - The transition's `to` state.
|
|
582
|
+
*/
|
|
583
|
+
assert(context: TContext, state: TState): Promise<void> | void;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Represents one row of a statechart table: the entity's state before an event, the event, and the
|
|
588
|
+
* state that event must leave it in.
|
|
589
|
+
*
|
|
590
|
+
* @typeParam TState - The states the entity moves between, as a string-literal union.
|
|
591
|
+
* @typeParam TEvent - The events the entity accepts, as a string-literal union.
|
|
592
|
+
* @remarks The two unions are the entity's own vocabulary, so a table naming a state or an event the
|
|
593
|
+
* entity does not have fails to typecheck rather than failing at runtime.
|
|
594
|
+
*/
|
|
595
|
+
export declare interface StateTransition<TState extends string, TEvent extends string> {
|
|
596
|
+
/** Holds the row's name, which is prepended to the message of whatever the row throws. */
|
|
597
|
+
readonly name: string;
|
|
598
|
+
/** Holds the state the row arranges before it acts. */
|
|
599
|
+
readonly from: TState;
|
|
600
|
+
/** Holds the event the row applies to the arranged entity. */
|
|
601
|
+
readonly event: TEvent;
|
|
602
|
+
/** Holds the state the row asserts the entity reached. */
|
|
603
|
+
readonly to: TState;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Represents one operation that produced a value.
|
|
608
|
+
*
|
|
609
|
+
* @typeParam T - The produced value type.
|
|
610
|
+
*/
|
|
611
|
+
export declare interface Success<T> {
|
|
612
|
+
/** Holds the discriminant that names the produced arm. */
|
|
613
|
+
readonly success: true;
|
|
614
|
+
/** Holds the value the operation produced. */
|
|
615
|
+
readonly value: T;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
/** Represents the work one teardown entry performs when the list is destroyed. */
|
|
370
619
|
export declare type TeardownHandler = () => void | Promise<void>;
|
|
371
620
|
|
|
372
|
-
/**
|
|
621
|
+
/** Represents the cleanup a test adds as it goes and runs once, newest first, when it is done. */
|
|
373
622
|
export declare interface TeardownInterface {
|
|
374
|
-
/**
|
|
623
|
+
/** Reports how many handlers are registered. */
|
|
375
624
|
readonly count: number;
|
|
376
625
|
/**
|
|
377
626
|
* Registers a handler to run when the list is destroyed.
|
|
@@ -419,7 +668,7 @@ export declare function waitForCondition(description: string, condition: () => b
|
|
|
419
668
|
/**
|
|
420
669
|
* Waits for a host timer to elapse.
|
|
421
670
|
*
|
|
422
|
-
* @param ms - The delay in milliseconds.
|
|
671
|
+
* @param ms - The delay in milliseconds. Default: `0`.
|
|
423
672
|
* @returns A promise that resolves after the timer fires.
|
|
424
673
|
*/
|
|
425
674
|
export declare function waitForDelay(ms?: number): Promise<void>;
|
|
@@ -447,11 +696,11 @@ export declare function waitForEvent<TArgs extends readonly unknown[]>(subscribe
|
|
|
447
696
|
* consumers do not agree on one. Each states its own numbers in its `@remarks`.
|
|
448
697
|
*/
|
|
449
698
|
export declare interface WaitOptions {
|
|
450
|
-
/**
|
|
699
|
+
/** Holds the elapsed-time limit in milliseconds. */
|
|
451
700
|
readonly budget?: number;
|
|
452
|
-
/**
|
|
701
|
+
/** Holds the delay between readings in milliseconds. */
|
|
453
702
|
readonly interval?: number;
|
|
454
|
-
/**
|
|
703
|
+
/** Holds the signal that aborts the wait. */
|
|
455
704
|
readonly signal?: AbortSignal;
|
|
456
705
|
}
|
|
457
706
|
|