Skip to content

Commit

Permalink
fix bun test.
Browse files Browse the repository at this point in the history
..

..
  • Loading branch information
igalklebanov committed Jun 1, 2024
1 parent 1f5640f commit d3b0c89
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 9 deletions.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"test:node:run": "mocha --timeout 15000 test/node/dist/**/*.test.js",
"test:browser:build": "rm -rf test/browser/bundle.js && esbuild test/browser/main.ts --bundle --outfile=test/browser/bundle.js",
"test:browser": "npm run build && npm run test:browser:build && node test/browser/test.js",
"test:bun": "npm run build && cd test/bun && bun install && bun run test",
"test:bun": "npm run build && bun link && cd test/bun && bun install && bun run test",
"test:cloudflare-workers": "npm run build && cd test/cloudflare-workers && npm ci && npm test",
"test:deno": "npm run build && deno run --allow-env --allow-read --allow-net test/deno/local.test.ts && deno run --allow-env --allow-read --allow-net test/deno/cdn.test.ts",
"test:typings": "tsd test/typings",
Expand Down Expand Up @@ -94,7 +94,7 @@
"prettier": "^3.1.1",
"sinon": "^17.0.1",
"tarn": "^3.0.2",
"tedious": "^16.4.0",
"tedious": "^17.0.0",
"tsd": "^0.30.3",
"typescript": "^5.4.2"
}
Expand Down
Binary file modified test/bun/bun.lockb
100644 → 100755
Binary file not shown.
37 changes: 37 additions & 0 deletions test/bun/bun.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { createPool } from 'mysql2'
import { Pool } from 'pg'
import * as Tarn from 'tarn'
import * as Tedious from 'tedious'
import {
Generated,
Kysely,
PostgresDialect,
MysqlDialect,
sql,
MssqlDialect,
} from '../../dist/esm/index.js'

interface Person {
Expand Down Expand Up @@ -40,6 +43,38 @@ const dbs = [
}),
}),
}),
new Kysely<Database>({
dialect: new MssqlDialect({
tarn: {
...Tarn,
options: {
min: 0,
max: 10,
},
},
tedious: {
...Tedious,
connectionFactory: () =>
new Tedious.Connection({
authentication: {
options: {
password: 'KyselyTest0',
userName: 'sa',
},
type: 'default',
},
options: {
connectTimeout: 3000,
database: 'kysely_test',
encrypt: false,
port: 21433,
trustServerCertificate: true,
},
server: 'localhost',
}),
},
}),
}),
]

if (
Expand All @@ -60,3 +95,5 @@ await Promise.all(dbs.map((db) => query.execute(db)))
console.log('bun test passed')

await Promise.all(dbs.map((db) => db.destroy()))

process.exit(0) // hangs otherwise...
10 changes: 8 additions & 2 deletions test/bun/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@
"test": "bun bun.test.ts"
},
"dependencies": {
"kysely": "^0.25.0",
"kysely": "link:kysely",
"mysql2": "^3.3.3",
"pg": "^8.11.0"
"pg": "^8.11.0",
"tarn": "^3.0.2",
"tedious": "^17.0.0"
},
"devDependencies": {
"@types/bun": "^1.1.3",
"typescript": "^5.4.5"
}
}

0 comments on commit d3b0c89

Please sign in to comment.