slack-term 1.31.2 → 1.31.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +59 -59
- package/package.json +1 -1
- package/ts/todo.ts +21 -1
package/package.json
CHANGED
package/ts/todo.ts
CHANGED
|
@@ -199,9 +199,29 @@ export const MAX_RATE_LIMIT_RETRIES = 3;
|
|
|
199
199
|
|
|
200
200
|
export const _internals = {
|
|
201
201
|
// Swappable so tests never wait real time (same pattern as tail.ts).
|
|
202
|
-
|
|
202
|
+
//
|
|
203
|
+
// The spy is NOT the only defence, and must not be: a stub installed in a
|
|
204
|
+
// `beforeEach` is undone by any `vi.restoreAllMocks()` in a nested block's
|
|
205
|
+
// `afterEach`, and the next test then backs off for REAL seconds. That is
|
|
206
|
+
// what wedged CI — `todo.test.ts` burned the whole job budget in the retry
|
|
207
|
+
// path while every other file finished in under two seconds, and it never
|
|
208
|
+
// reproduced locally because the timing differs.
|
|
209
|
+
//
|
|
210
|
+
// So the backoff itself refuses to sleep under a test runner. Detecting the
|
|
211
|
+
// environment is ugly, but the alternative is a rule ("never let a nested
|
|
212
|
+
// afterEach restore this") that has to be remembered by every future test —
|
|
213
|
+
// and it already was not.
|
|
214
|
+
sleep: (ms: number): Promise<void> =>
|
|
215
|
+
isTestEnv() ? Promise.resolve() : new Promise((res) => setTimeout(res, ms)),
|
|
203
216
|
};
|
|
204
217
|
|
|
218
|
+
/** True under vitest or `bun test`. Both set NODE_ENV=test; vitest also sets
|
|
219
|
+
* VITEST. Checked at call time, not at import, so a test that deliberately
|
|
220
|
+
* wants the real timer can clear it. */
|
|
221
|
+
function isTestEnv(): boolean {
|
|
222
|
+
return !!process.env.VITEST || process.env.NODE_ENV === "test" || !!process.env.BUN_TEST;
|
|
223
|
+
}
|
|
224
|
+
|
|
205
225
|
/** Run an API call, backing off and retrying on 429. Mirrors tail.ts: warn on
|
|
206
226
|
* stderr, sleep `retryAfter`, try again — but bounded, so a persistently
|
|
207
227
|
* throttled workspace fails loudly instead of hanging forever. */
|