Skip to content

Commit

Permalink
ci: test against older TypeScript versions. (#1192)
Browse files Browse the repository at this point in the history
  • Loading branch information
igalklebanov authored Oct 24, 2024
1 parent cb4914a commit 997b743
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 46 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x, 22.x]

Expand Down Expand Up @@ -41,6 +42,7 @@ jobs:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x, 22.x]

Expand All @@ -67,6 +69,7 @@ jobs:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
deno-version: [1.46.x]

Expand Down Expand Up @@ -98,6 +101,7 @@ jobs:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
bun-version: [1.1.26]

Expand Down Expand Up @@ -167,3 +171,42 @@ jobs:

- name: Run cloudflare workers test
run: npm run test:cloudflare-workers

older-typescript-version:
name: Older TypeScript version
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
typescript-version: [
^4.6, # 28.2.2022 https://devblogs.microsoft.com/typescript/announcing-typescript-4-6/
^4.7, # 24.5.2022 https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/
^4.8, # 25.8.2022 https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/
^4.9, # 15.11.2022 https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/
^5.0, # 16.3.2023 https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/
^5.2, # 24.8.2023 https://devblogs.microsoft.com/typescript/announcing-typescript-5-1/ https://devblogs.microsoft.com/typescript/announcing-typescript-5-2/
^5.3, # 20.11.2023 https://devblogs.microsoft.com/typescript/announcing-typescript-5-3/
^5.4, # 6.3.2024 https://devblogs.microsoft.com/typescript/announcing-typescript-5-4/
]

steps:
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run build with newer TypeScript
run: npm run build

- name: Install older TypeScript
run: npm i -D typescript@${{ matrix.typescript-version }} tsd@${{ fromJson('{ "^4.6":"0.20.0", "^4.7":"0.22.0", "^4.8":"0.24.1", "^4.9":"0.27.0", "^5.0":"0.28.1", "^5.2":"0.29.0", "^5.3":"0.30.7", "^5.4":"0.31.2" }')[matrix.typescript-version] }}

- name: Run tests with older TypeScript
run: npm run test:typings && npm run test:node:build
8 changes: 4 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,6 @@
"tarn": "^3.0.2",
"tedious": "^19.0.0",
"tsd": "^0.31.1",
"typescript": "^5.6.2"
"typescript": "^5.6.3"
}
}
3 changes: 1 addition & 2 deletions src/query-builder/merge-query-builder.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AliasedExpression, type Expression } from '../expression/expression.js'
import { AliasedExpression, Expression } from '../expression/expression.js'
import { InsertQueryNode } from '../operation-node/insert-query-node.js'
import { MergeQueryNode } from '../operation-node/merge-query-node.js'
import { OperationNodeSource } from '../operation-node/operation-node-source.js'
Expand Down Expand Up @@ -45,7 +45,6 @@ import {
SimplifySingleResult,
SqlBool,
} from '../util/type-utils.js'
import { InsertQueryBuilder } from './insert-query-builder.js'
import { MergeResult } from './merge-result.js'
import {
NoResultError,
Expand Down
79 changes: 42 additions & 37 deletions test/node/src/test-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,48 +122,53 @@ if (process.env.TEST_TRANSFORMER) {

export const POOL_SIZE = 20

export const DIALECT_CONFIGS = {
postgres: {
database: 'kysely_test',
host: 'localhost',
user: 'kysely',
port: 5434,
max: POOL_SIZE,
} satisfies PoolConfig,

mysql: {
database: 'kysely_test',
host: 'localhost',
user: 'kysely',
password: 'kysely',
port: 3308,
// Return big numbers as strings just like pg does.
supportBigNumbers: true,
bigNumberStrings: true,
const POSTGRES_CONFIG: PoolConfig = {
database: 'kysely_test',
host: 'localhost',
user: 'kysely',
port: 5434,
max: POOL_SIZE,
}

connectionLimit: POOL_SIZE,
} satisfies PoolOptions,
const MYSQL_CONFIG: PoolOptions = {
database: 'kysely_test',
host: 'localhost',
user: 'kysely',
password: 'kysely',
port: 3308,
// Return big numbers as strings just like pg does.
supportBigNumbers: true,
bigNumberStrings: true,

connectionLimit: POOL_SIZE,
}

mssql: {
authentication: {
options: {
password: 'KyselyTest0',
userName: 'sa',
},
type: 'default',
},
const MSSQL_CONFIG: ConnectionConfiguration = {
authentication: {
options: {
connectTimeout: 3000,
database: 'kysely_test',
port: 21433,
trustServerCertificate: true,
password: 'KyselyTest0',
userName: 'sa',
},
server: 'localhost',
} satisfies ConnectionConfiguration,

sqlite: {
databasePath: ':memory:',
type: 'default',
},
options: {
connectTimeout: 3000,
database: 'kysely_test',
port: 21433,
trustServerCertificate: true,
},
server: 'localhost',
}

const SQLITE_CONFIG = {
databasePath: ':memory:',
}

export const DIALECT_CONFIGS = {
postgres: POSTGRES_CONFIG,
mysql: MYSQL_CONFIG,
mssql: MSSQL_CONFIG,
sqlite: SQLITE_CONFIG,
}

export const DB_CONFIGS: PerDialect<KyselyConfig> = {
Expand Down
2 changes: 1 addition & 1 deletion test/node/src/transaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ for (const dialect of DIALECTS) {
'repeatable read',
'serializable',
...(dialect === 'mssql' ? (['snapshot'] as const) : []),
] satisfies IsolationLevel[]) {
] as const) {
it(`should set the transaction isolation level as "${isolationLevel}"`, async () => {
await ctx.db
.transaction()
Expand Down
3 changes: 2 additions & 1 deletion test/node/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"include": ["src/**/*"],
"compilerOptions": {
"module": "CommonJS",
"outDir": "dist"
"outDir": "dist",
"skipLibCheck": true
}
}

0 comments on commit 997b743

Please sign in to comment.