Skip to content

Commit 2eacc7b

Browse files
committed
A stab at the dark to avoid "test did not finish before its parent"
1 parent 01f8fd6 commit 2eacc7b

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

test/node/socks.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class MockServer5 {
138138
}
139139
}
140140

141-
describe('SOCKS layer', { timeout: 1000 }, () => {
141+
describe('SOCKS layer', { timeout: 1000 }, async () => {
142142
let server5!: MockServer5
143143
let server4: Server | undefined
144144

@@ -151,7 +151,7 @@ describe('SOCKS layer', { timeout: 1000 }, () => {
151151
server4?.close()
152152
})
153153

154-
it('should resolve hostnames locally for socks5', async () => {
154+
await it('should resolve hostnames locally for socks5', async () => {
155155
const port = await server5.start()
156156

157157
const lookup = mock.fn((_: string) =>
@@ -181,7 +181,7 @@ describe('SOCKS layer', { timeout: 1000 }, () => {
181181
assert.strictEqual(server5.destinationPort(), 1883)
182182
})
183183

184-
it('should resolve hostnames remotely for socks5h', async () => {
184+
await it('should resolve hostnames remotely for socks5h', async () => {
185185
const port = await server5.start()
186186

187187
const lookup = mock.fn((_: string) =>
@@ -210,7 +210,7 @@ describe('SOCKS layer', { timeout: 1000 }, () => {
210210
assert.strictEqual(server5.destinationPort(), 1883)
211211
})
212212

213-
it('errors during name resolution should be emitted on stream', async () => {
213+
await it('errors during name resolution should be emitted on stream', async () => {
214214
const ERROR = new Error()
215215

216216
const lookup = mock.fn((address) => Promise.reject(ERROR))
@@ -226,7 +226,7 @@ describe('SOCKS layer', { timeout: 1000 }, () => {
226226
assert.strictEqual(error, ERROR)
227227
})
228228

229-
it('errors during SOCKS connect should be emitted on stream', async () => {
229+
await it('errors during SOCKS connect should be emitted on stream', async () => {
230230
const port = await server5.start()
231231
server5.responseID = Buffer.from([0x00, 0x00])
232232

@@ -252,7 +252,7 @@ describe('SOCKS layer', { timeout: 1000 }, () => {
252252
assert(err instanceof Error)
253253
})
254254

255-
it('data flows through the stream after SOCKS has connected', async () => {
255+
await it('data flows through the stream after SOCKS has connected', async () => {
256256
const port = await server5.start()
257257

258258
const lookup = mock.fn((_: string) =>
@@ -290,7 +290,7 @@ describe('SOCKS layer', { timeout: 1000 }, () => {
290290
assert.strictEqual(response, 'ping pong')
291291
})
292292

293-
it('data written to the stream is buffered until SOCKS has connected', async () => {
293+
await it('data written to the stream is buffered until SOCKS has connected', async () => {
294294
const port = await server5.start()
295295

296296
let startNameResolution!: () => undefined
@@ -336,7 +336,7 @@ describe('SOCKS layer', { timeout: 1000 }, () => {
336336
assert.strictEqual(response, 'ping pong')
337337
})
338338

339-
it('closing the stream closes the connection', async () => {
339+
await it('closing the stream closes the connection', async () => {
340340
const port = await server5.start()
341341

342342
const lookup = mock.fn((_: string) =>
@@ -361,7 +361,7 @@ describe('SOCKS layer', { timeout: 1000 }, () => {
361361
})
362362
})
363363

364-
it('closing the connection closes the stream', async () => {
364+
await it('closing the connection closes the stream', async () => {
365365
const port = await server5.start()
366366

367367
const lookup = mock.fn((_: string) =>
@@ -385,7 +385,7 @@ describe('SOCKS layer', { timeout: 1000 }, () => {
385385
})
386386
})
387387

388-
it('resetting the connection errors the stream', async () => {
388+
await it('resetting the connection errors the stream', async () => {
389389
const port = await server5.start()
390390

391391
const lookup = mock.fn((_: string) =>
@@ -411,7 +411,7 @@ describe('SOCKS layer', { timeout: 1000 }, () => {
411411
assert(error instanceof Error)
412412
})
413413

414-
it('an invalid protocol errors the stream', async () => {
414+
await it('an invalid protocol errors the stream', async () => {
415415
const port = await server5.start()
416416

417417
const lookup = mock.fn((_: string) =>
@@ -429,7 +429,7 @@ describe('SOCKS layer', { timeout: 1000 }, () => {
429429
assert(error instanceof Error)
430430
})
431431

432-
it('an invalid URL errors the stream', async () => {
432+
await it('an invalid URL errors the stream', async () => {
433433
const port = await server5.start()
434434

435435
const lookup = mock.fn((_: string) =>
@@ -447,7 +447,7 @@ describe('SOCKS layer', { timeout: 1000 }, () => {
447447
assert(error instanceof Error)
448448
})
449449

450-
it('should resolve hostnames locally for socks4', async () => {
450+
await it('should resolve hostnames locally for socks4', async () => {
451451
let onConnect!: (socket: Socket) => void
452452
const connect = new Promise<Socket>((r) => {
453453
onConnect = mock.fn((socket: Socket) => {
@@ -487,7 +487,7 @@ describe('SOCKS layer', { timeout: 1000 }, () => {
487487
assert.strictEqual(lookup.mock.calls[0].arguments[0], 'foo.bar')
488488
})
489489

490-
it('should resolve hostnames remotely for socks4a', async () => {
490+
await it('should resolve hostnames remotely for socks4a', async () => {
491491
let onConnect!: (socket: Socket) => void
492492
const connect = new Promise<Socket>((r) => {
493493
onConnect = mock.fn((socket: Socket) => {

0 commit comments

Comments
 (0)