Skip to content

Commit 3c22e34

Browse files
authored
test(bun): basic e2e tests (#457)
* test(bun): basic e2e tests * update CI * update * update * update
1 parent 61719d5 commit 3c22e34

File tree

19 files changed

+574
-56
lines changed

19 files changed

+574
-56
lines changed

.github/workflows/build-test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ jobs:
5151
node-version: ${{ matrix.node-version }}
5252
cache: 'pnpm'
5353

54+
- name: Use Bun
55+
uses: oven-sh/setup-bun@v2
56+
with:
57+
bun-version: latest
58+
5459
- name: Get pnpm store directory
5560
id: pnpm-cache
5661
shell: bash

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"build": "turbo run build",
99
"watch": "turbo run watch build",
1010
"lint": "turbo run lint",
11-
"test": "vitest run",
11+
"test": "turbo run test",
1212
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
1313
"pr": "gh pr create --fill-first --base dev",
1414
"merge-main": "gh pr create --title \"merge dev to main\" --body \"\" --base main --head dev",

packages/testtools/src/client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ export function getTestDbProvider() {
2525
return val as 'sqlite' | 'postgresql';
2626
}
2727

28-
const TEST_PG_CONFIG = {
28+
export const TEST_PG_CONFIG = {
2929
host: process.env['TEST_PG_HOST'] ?? 'localhost',
3030
port: process.env['TEST_PG_PORT'] ? parseInt(process.env['TEST_PG_PORT']) : 5432,
3131
user: process.env['TEST_PG_USER'] ?? 'postgres',
3232
password: process.env['TEST_PG_PASSWORD'] ?? 'postgres',
3333
};
3434

35+
export const TEST_PG_URL = `postgres://${TEST_PG_CONFIG.user}:${TEST_PG_CONFIG.password}@${TEST_PG_CONFIG.host}:${TEST_PG_CONFIG.port}`;
36+
3537
type ExtraTestClientOptions = {
3638
/**
3739
* Database provider
@@ -104,10 +106,7 @@ export async function createTestClient(
104106
let _schema: SchemaDef;
105107
const provider = options?.provider ?? getTestDbProvider() ?? 'sqlite';
106108
const dbName = options?.dbName ?? getTestDbName(provider);
107-
const dbUrl =
108-
provider === 'sqlite'
109-
? `file:${dbName}`
110-
: `postgres://${TEST_PG_CONFIG.user}:${TEST_PG_CONFIG.password}@${TEST_PG_CONFIG.host}:${TEST_PG_CONFIG.port}/${dbName}`;
109+
const dbUrl = provider === 'sqlite' ? `file:${dbName}` : `${TEST_PG_URL}/${dbName}`;
111110

112111
let model: Model | undefined;
113112

pnpm-lock.yaml

Lines changed: 76 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,29 @@ packages:
22
- packages/**
33
- samples/**
44
- tests/**
5+
56
catalog:
7+
'@tanstack/react-query': 5.90.6
8+
'@types/better-sqlite3': ^7.6.13
9+
'@types/node': ^20.19.0
10+
'@types/react': 19.2.0
11+
'@types/react-dom': 19.2.0
12+
'@types/tmp': ^0.2.6
13+
better-sqlite3: ^12.2.0
14+
decimal.js: ^10.4.3
615
kysely: ~0.28.8
7-
zod: ^4.0.0
8-
prisma: ^6.19.0
916
langium: 3.5.0
1017
langium-cli: 3.5.0
11-
ts-pattern: ^5.7.1
12-
typescript: ^5.9.3
13-
'@types/node': ^20.19.0
14-
tmp: ^0.2.3
15-
'@types/tmp': ^0.2.6
16-
'zod-validation-error': ^4.0.1
17-
'better-sqlite3': ^12.2.0
18-
'@types/better-sqlite3': ^7.6.13
19-
'pg': ^8.13.1
20-
'sql.js': ^1.13.0
21-
'decimal.js': '^10.4.3'
18+
next: 16.0.1
19+
pg: ^8.13.1
20+
prisma: ^6.19.0
2221
react: 19.2.0
23-
'@types/react': 19.2.0
2422
react-dom: 19.2.0
25-
'@types/react-dom': 19.2.0
26-
'@tanstack/react-query': 5.90.6
27-
'next': 16.0.1
28-
'vue': 3.5.22
29-
'svelte': 5.43.3
23+
sql.js: ^1.13.0
24+
svelte: 5.43.3
25+
tmp: ^0.2.3
26+
ts-pattern: ^5.7.1
27+
typescript: ^5.9.3
28+
vue: 3.5.22
29+
zod: ^4.0.0
30+
zod-validation-error: ^4.0.1

0 commit comments

Comments
 (0)