bun-types-no-globals 1.3.1 → 1.3.2-canary.20251025T140614
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/lib/test.d.ts +22 -0
- package/package.json +1 -1
package/lib/test.d.ts
CHANGED
|
@@ -358,6 +358,28 @@ declare module "bun:test" {
|
|
|
358
358
|
fn: (() => void | Promise<unknown>) | ((done: (err?: unknown) => void) => void),
|
|
359
359
|
options?: HookOptions,
|
|
360
360
|
): void;
|
|
361
|
+
/**
|
|
362
|
+
* Runs a function after a test finishes, including after all afterEach hooks.
|
|
363
|
+
*
|
|
364
|
+
* This is useful for cleanup tasks that need to run at the very end of a test,
|
|
365
|
+
* after all other hooks have completed.
|
|
366
|
+
*
|
|
367
|
+
* Can only be called inside a test, not in describe blocks.
|
|
368
|
+
*
|
|
369
|
+
* @example
|
|
370
|
+
* test("my test", () => {
|
|
371
|
+
* onTestFinished(() => {
|
|
372
|
+
* // This runs after all afterEach hooks
|
|
373
|
+
* console.log("Test finished!");
|
|
374
|
+
* });
|
|
375
|
+
* });
|
|
376
|
+
*
|
|
377
|
+
* @param fn the function to run
|
|
378
|
+
*/
|
|
379
|
+
export function onTestFinished(
|
|
380
|
+
fn: (() => void | Promise<unknown>) | ((done: (err?: unknown) => void) => void),
|
|
381
|
+
options?: HookOptions,
|
|
382
|
+
): void;
|
|
361
383
|
/**
|
|
362
384
|
* Sets the default timeout for all tests in the current file. If a test specifies a timeout, it will
|
|
363
385
|
* override this value. The default timeout is 5000ms (5 seconds).
|
package/package.json
CHANGED