Skip to content

Commit bcce97b

Browse files
authored
Add bun runtime tests (#607)
* Add bun and deno runtime tests * fix test * update package.json * run bun tests after build on linux * concurrency
1 parent deb5b27 commit bcce97b

4 files changed

Lines changed: 21 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ jobs:
205205
curl -fsSL https://rpm.nodesource.com/setup_20.x | bash -
206206
yum install -y nodejs --setopt=nodesource-nodejs.module_hotfixes=1
207207
npm install --global pnpm
208+
npm install --global bun
208209
209210
groupadd -g "$HOST_GID" hostgroup 2>/dev/null || true
210211
useradd -m -u "$HOST_UID" -g "$HOST_GID" hostuser 2>/dev/null || true
@@ -230,6 +231,9 @@ jobs:
230231
export LIVEKIT_API_KEY=${{ secrets.LIVEKIT_API_KEY }}
231232
export LIVEKIT_API_SECRET=${{ secrets.LIVEKIT_API_SECRET }}
232233
pnpm --filter "@livekit/rtc-node" test
234+
bun install
235+
bun test --concurrent
236+
233237
"
234238
'
235239

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,10 @@
4141
"typescript": "5.8.2",
4242
"vitest": "^3.0.0"
4343
},
44+
"workspaces": [
45+
"examples/*",
46+
"packages/*",
47+
"packages/livekit-rtc/npm/*"
48+
],
4449
"packageManager": "pnpm@10.18.2"
4550
}

packages/livekit-rtc/src/tests/e2e.test.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { AccessToken } from 'livekit-server-sdk';
55
import { randomUUID } from 'node:crypto';
66
import { setTimeout as delay } from 'node:timers/promises';
7-
import { afterAll, describe, expect, it } from 'vitest';
7+
import { afterAll, describe, expect, it as itRaw } from 'vitest';
88
import {
99
AudioFrame,
1010
AudioSource,
@@ -20,6 +20,9 @@ import {
2020
dispose,
2121
} from '../index.js';
2222

23+
// use concurrent testing if available on the runner (currently not supported by bun's api)
24+
const it = typeof itRaw.concurrent === 'function' ? itRaw.concurrent : itRaw;
25+
2326
const hasE2EEnv =
2427
!!process.env.LIVEKIT_URL && !!process.env.LIVEKIT_API_KEY && !!process.env.LIVEKIT_API_SECRET;
2528
const describeE2E = hasE2EEnv ? describe : describe.skip;
@@ -202,7 +205,7 @@ describeE2E('livekit-rtc e2e', () => {
202205
await dispose();
203206
});
204207

205-
it.concurrent(
208+
it(
206209
'connects to a room',
207210
async () => {
208211
const { roomName, rooms } = await connectTestRooms(1);
@@ -225,7 +228,7 @@ describeE2E('livekit-rtc e2e', () => {
225228
testTimeoutMs,
226229
);
227230

228-
it.concurrent(
231+
it(
229232
'connects multiple participants to the same room',
230233
async () => {
231234
const { roomName, rooms } = await connectTestRooms(2);
@@ -241,7 +244,7 @@ describeE2E('livekit-rtc e2e', () => {
241244
testTimeoutMs,
242245
);
243246

244-
it.concurrent(
247+
it(
245248
'emits participantDisconnected when a participant leaves',
246249
async () => {
247250
const { rooms } = await connectTestRooms(2);
@@ -267,7 +270,7 @@ describeE2E('livekit-rtc e2e', () => {
267270
testTimeoutMs,
268271
);
269272

270-
it.concurrent(
273+
it(
271274
'transfers audio between two participants (sine detection)',
272275
async () => {
273276
const cases = [
@@ -367,7 +370,7 @@ describeE2E('livekit-rtc e2e', () => {
367370
testTimeoutMs * 2,
368371
);
369372

370-
it.concurrent(
373+
it(
371374
'publishes and receives reliable data packets',
372375
async () => {
373376
const { rooms } = await connectTestRooms(2);
@@ -407,7 +410,7 @@ describeE2E('livekit-rtc e2e', () => {
407410
testTimeoutMs,
408411
);
409412

410-
it.concurrent(
413+
it(
411414
'sends and receives text and byte streams',
412415
async () => {
413416
const { rooms } = await connectTestRooms(2);
@@ -469,7 +472,7 @@ describeE2E('livekit-rtc e2e', () => {
469472
testTimeoutMs,
470473
);
471474

472-
it.concurrent(
475+
it(
473476
'invokes RPC methods and returns structured errors',
474477
async () => {
475478
const { rooms } = await connectTestRooms(2);

packages/livekit-server-sdk/src/AccessToken.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ describe('identity is required for only join grants', () => {
5959
const t = new AccessToken(testApiKey, testSecret);
6060
t.addGrant({ roomJoin: true });
6161

62-
await expect(async () => {
63-
await t.toJwt();
64-
}).rejects.toThrow();
62+
await expect(t.toJwt()).rejects.toThrow();
6563
});
6664
});
6765

0 commit comments

Comments
 (0)