Skip to content

Commit 107dde0

Browse files
committed
chore: up tests
1 parent 73a567e commit 107dde0

File tree

6 files changed

+12
-9
lines changed

6 files changed

+12
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"check:types": "tsc",
88
"dev": "zile dev",
99
"postinstall": "pnpm dev",
10-
"test": "vitest"
10+
"test": "vitest --testTimeout=10000"
1111
},
1212
"devDependencies": {
1313
"@biomejs/biome": "^2.3.8",

src/Instance.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ test('default', async () => {
77
return {
88
name: 'foo',
99
host: 'localhost',
10-
port: 3000,
1110
async start() {
1211
started = true
1312
},

src/Pool.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ afterEach(async () => {
2626
})
2727

2828
describe.each([
29-
{ instance: Instance.anvil({ port: await getPort() }) },
30-
{ instance: Instance.tempo({ port: await getPort() }) },
29+
{ instance: Instance.anvil({ port: port + 1 }) },
30+
{ instance: Instance.tempo({ port: port + 2 }) },
3131
{
3232
instance: Instance.alto(altoOptions({ port, pool: true })),
3333
},

src/Server.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ beforeAll(async () => {
1717
})
1818

1919
describe.each([
20-
{ instance: Instance.anvil() },
21-
{ instance: Instance.tempo() },
20+
{ instance: Instance.anvil({ port: port + 1 }) },
21+
{ instance: Instance.tempo({ port: port + 2 }) },
2222
{
2323
instance: Instance.alto(altoOptions({ port, pool: true })),
2424
},

src/instances/tempo.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
import { setTimeout } from 'node:timers/promises'
21
import { afterEach, expect, test } from 'vitest'
32
import type { Instance } from '../Instance.js'
43
import { type TempoParameters, tempo } from './tempo.js'
4+
import getPort from 'get-port'
55

66
const instances: Instance[] = []
77

8+
const port = await getPort()
9+
810
const defineInstance = (parameters: TempoParameters = {}) => {
9-
const instance = tempo(parameters)
11+
const instance = tempo({ ...parameters, port })
1012
instances.push(instance)
1113
return instance
1214
}

src/processes/execa.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { EventEmitter } from 'eventemitter3'
22
import { afterEach, expect, test } from 'vitest'
33
import { execa } from './execa.js'
4+
import getPort from 'get-port'
45

56
const processes: execa.ReturnType[] = []
67
function createProcess() {
@@ -121,7 +122,8 @@ test('behavior: exit when status is starting', async () => {
121122
emitter.on('exit', resolvers.exit.resolve)
122123

123124
// Invalid argument
124-
await process.start(($) => $`anvil`, {
125+
const port = await getPort()
126+
await process.start(($) => $`anvil --port ${port}`, {
125127
emitter,
126128
status: 'starting',
127129
resolver({ process, resolve }) {

0 commit comments

Comments
 (0)