Skip to content

Commit cb40f3c

Browse files
committed
test(cli): use the package's own delay helper in the staging poll
The audit bans a hand-rolled setTimeout promise. `sim-cli` does not depend on the shared utils package, and its own idiom is `node:timers/promises`.
1 parent 2f85b5f commit cb40f3c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

packages/sim-cli/src/commands/protocol/files-get.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
import { tmpdir } from 'node:os'
1313
import { join } from 'node:path'
1414
import { Writable } from 'node:stream'
15+
import { setTimeout as sleep } from 'node:timers/promises'
1516
import { Command } from 'commander'
1617
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
1718
import { buildGeneratedCommands } from '../../runtime/build'
@@ -166,7 +167,7 @@ describe('an interrupted download', () => {
166167
for (let attempt = 0; attempt < 2000; attempt += 1) {
167168
const [staged] = stagingDirectories()
168169
if (staged) return join(dir, staged)
169-
await new Promise((resolve) => setTimeout(resolve, 1))
170+
await sleep(1)
170171
}
171172
throw new Error('the download staged no directory')
172173
}

0 commit comments

Comments
 (0)