test: ignore coverage to test nextTickFn

This commit is contained in:
鲁树人 2023-06-05 00:04:59 +01:00
parent b97f089bac
commit 647a70bf83

View File

@ -1,10 +1,13 @@
type NextTickFn = (callback: () => void) => void;
/* c8 ignore start */
const nextTickFn =
typeof setImmediate !== 'undefined'
? (setImmediate as NextTickFn)
: typeof requestAnimationFrame !== 'undefined'
? (requestAnimationFrame as NextTickFn)
: (setTimeout as NextTickFn);
/* c8 ignore stop */
export async function nextTickAsync() {
return new Promise<void>((resolve) => nextTickFn(resolve));