We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2b7efc8 commit f55197eCopy full SHA for f55197e
packages/repo-tools/src/test-utils/abort-signal.ts
@@ -3,6 +3,13 @@ import { vi } from 'vitest';
3
/**
4
* Create a mock AbortSignal that can be manually aborted.
5
*
6
+ * This utility was created because Vitest cannot mock `AbortSignal.timeout()`.
7
+ * Vitest relies on @sinonjs/fake-timers for timer mocking, but fake-timers does
8
+ * not implement the AbortSignal.timeout API, so we cannot use Vitest's timer
9
+ * mocking to test timeout behavior. This mock allows us to manually trigger
10
+ * abort events in tests to simulate timeout scenarios.
11
+ * https://github.com/vitest-dev/vitest/issues/3088
12
+ *
13
* @param timeoutMs - The timeout value (stored for verification).
14
* @returns A mock AbortSignal.
15
*/
0 commit comments