twd-js 1.2.1 → 1.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/dist/index.cjs.js +25 -25
- package/dist/index.d.ts +10 -5
- package/dist/index.es.js +648 -630
- package/dist/mock-sw.js +1 -1
- package/dist/runner-ci.cjs.js +1 -1
- package/dist/runner-ci.es.js +22 -33
- package/package.json +6 -7
- package/dist/_commonjsHelpers-C6fGbg64.mjs +0 -6
- package/dist/_commonjsHelpers-DwGv2jUC.js +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -243,16 +243,20 @@ declare interface TWDAPI {
|
|
|
243
243
|
/**
|
|
244
244
|
* Wait for a mocked request to be made.
|
|
245
245
|
* @param alias The alias of the mock rule to wait for
|
|
246
|
+
* @param retries The number of retries to make
|
|
247
|
+
* @param retryDelay The delay between retries
|
|
246
248
|
* @return The matched rule (with body if applicable)
|
|
247
249
|
*
|
|
248
250
|
* @example
|
|
249
251
|
* ```ts
|
|
250
252
|
* const rule = await twd.waitFor("aliasId");
|
|
251
253
|
* console.log(rule.body);
|
|
254
|
+
* const rule = await twd.waitFor("aliasId", 5, 100);
|
|
255
|
+
* console.log(rule.body);
|
|
252
256
|
*
|
|
253
257
|
* ```
|
|
254
258
|
*/
|
|
255
|
-
waitForRequest: (alias: string) => Promise<Rule>;
|
|
259
|
+
waitForRequest: (alias: string, retries?: number, retryDelay?: number) => Promise<Rule>;
|
|
256
260
|
/**
|
|
257
261
|
* wait for a list of mocked requests to be made.
|
|
258
262
|
* @param aliases The aliases of the mock rules to wait for
|
|
@@ -276,15 +280,16 @@ declare interface TWDAPI {
|
|
|
276
280
|
url: () => URLCommandAPI;
|
|
277
281
|
/**
|
|
278
282
|
* Initializes request mocking (registers the service worker).
|
|
279
|
-
*
|
|
283
|
+
* @param [path] service worker absolute path (optional)
|
|
280
284
|
*
|
|
281
285
|
* @example
|
|
282
286
|
* ```ts
|
|
283
287
|
* await twd.initRequestMocking();
|
|
284
|
-
*
|
|
288
|
+
* // init with custom service worker path
|
|
289
|
+
* await twd.initRequestMocking('/test-path/mock-sw.js');
|
|
285
290
|
* ```
|
|
286
291
|
*/
|
|
287
|
-
initRequestMocking: () => Promise<void>;
|
|
292
|
+
initRequestMocking: (path?: string) => Promise<void>;
|
|
288
293
|
/**
|
|
289
294
|
* Clears all request mock rules.
|
|
290
295
|
*
|
|
@@ -423,7 +428,7 @@ declare type URLAssertionName = "eq" | "contain.url";
|
|
|
423
428
|
|
|
424
429
|
declare type URLCommandAPI = {
|
|
425
430
|
location: Location;
|
|
426
|
-
should: (name: AnyURLAssertion, value: string) =>
|
|
431
|
+
should: (name: AnyURLAssertion, value: string, retries?: number) => Promise<string>;
|
|
427
432
|
};
|
|
428
433
|
|
|
429
434
|
declare type UserEvent = typeof default_2;
|