INIT
CI / build (push) Has been skipped
CI / deploy (push) Successful in 1m11s

This commit is contained in:
eewing
2026-02-18 15:17:47 -06:00
parent e74c106f85
commit ec317eb17c
11532 changed files with 1631690 additions and 1 deletions
+3
View File
@@ -0,0 +1,3 @@
export declare function testWithEffect(name: string, fn: () => void | Promise<void>): void;
export declare function effectRootScope(fn: () => void | Promise<void>): void | Promise<void>;
export declare function vitestSetTimeoutWrapper(fn: () => void, timeout: number): void;
+22
View File
@@ -0,0 +1,22 @@
import { test, vi } from "vitest";
export function testWithEffect(name, fn) {
test(name, () => effectRootScope(fn));
}
export function effectRootScope(fn) {
let promise;
const cleanup = $effect.root(() => {
promise = fn();
});
if (promise instanceof Promise) {
return promise.finally(cleanup);
}
else {
cleanup();
}
}
export function vitestSetTimeoutWrapper(fn, timeout) {
setTimeout(() => {
fn();
}, timeout);
vi.advanceTimersByTime(timeout);
}