Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

@vitest/utils

Package Overview
Dependencies
Maintainers
5
Versions
178
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vitest/utils - npm Package Compare versions

Comparing version
4.0.14
to
4.0.15
+16
-1
dist/timers.d.ts

@@ -16,4 +16,19 @@ interface SafeTimers {

declare function setSafeTimers(): void;
/**
* Returns a promise that resolves after the specified duration.
*
* @param timeout - Delay in milliseconds
* @param scheduler - Timer function to use, defaults to `setTimeout`. Useful for mocked timers.
*
* @example
* await delay(100)
*
* @example
* // With mocked timers
* const { setTimeout } = getSafeTimers()
* await delay(100, setTimeout)
*/
declare function delay(timeout: number, scheduler?: typeof setTimeout): Promise<void>;
export { getSafeTimers, setSafeTimers };
export { delay, getSafeTimers, setSafeTimers };
export type { SafeTimers };

@@ -31,3 +31,20 @@ const SAFE_TIMERS_SYMBOL = Symbol("vitest:SAFE_TIMERS");

}
/**
* Returns a promise that resolves after the specified duration.
*
* @param timeout - Delay in milliseconds
* @param scheduler - Timer function to use, defaults to `setTimeout`. Useful for mocked timers.
*
* @example
* await delay(100)
*
* @example
* // With mocked timers
* const { setTimeout } = getSafeTimers()
* await delay(100, setTimeout)
*/
function delay(timeout, scheduler = setTimeout) {
return new Promise((resolve) => scheduler(resolve, timeout));
}
export { getSafeTimers, setSafeTimers };
export { delay, getSafeTimers, setSafeTimers };
+2
-2
{
"name": "@vitest/utils",
"type": "module",
"version": "4.0.14",
"version": "4.0.15",
"description": "Shared Vitest utility functions",

@@ -85,3 +85,3 @@ "license": "MIT",

"tinyrainbow": "^3.0.3",
"@vitest/pretty-format": "4.0.14"
"@vitest/pretty-format": "4.0.15"
},

@@ -88,0 +88,0 @@ "devDependencies": {