export const resolvedPromise = Promise.resolve(true);

export async function waitFor<T>(action: () => T | Promise<T>, checkEveryMilliseconds: number = 500, tryForMilliseconds: number = 10000, token?: { isCancellationRequested: boolean }): Promise<T | undefined> {
	let timeRemaining = tryForMilliseconds;
	while (timeRemaining > 0 && !(token && token.isCancellationRequested)) {
		const res = await action();
		if (res)
			return res;
		await new Promise((resolve) => setTimeout(resolve, checkEveryMilliseconds));
		timeRemaining -= checkEveryMilliseconds;
	}
}

export const resolvedPromise = Promise.resolve(true);

export async function waitFor<T>(action: () => T | Promise<T>, checkEveryMilliseconds: number = 100, tryForMilliseconds: number = 10000, token?: { isCancellationRequested: boolean }): Promise<T | undefined> {
	let timeRemaining = tryForMilliseconds;
	while (timeRemaining > 0 && !(token && token.isCancellationRequested)) {
		const res = await action();
		if (res)
			return res;
		await new Promise((resolve) => setTimeout(resolve, checkEveryMilliseconds));
		timeRemaining -= checkEveryMilliseconds;
	}
}

Reduce default checkEveryMilliseconds to speed up tests a little
Reduce default checkEveryMilliseconds to speed up tests a little
