Skip to content

Commit

Permalink
fix TS backwards compat following ControlledTransaction. (#1193)
Browse files Browse the repository at this point in the history
  • Loading branch information
igalklebanov committed Nov 2, 2024
1 parent 393fcce commit 93b6ee2
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 184 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,8 @@ jobs:
- 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: Exclude non-backward compatible tests
run: npx tsx ./scripts/exclude-test-files-for-backwards-compat.mts

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

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

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"@types/node": "^22.5.0",
"@types/pg": "^8.11.6",
"@types/pg-cursor": "^2.7.2",
"@types/semver": "^7.5.8",
"@types/sinon": "^17.0.2",
"@types/tedious": "^4.0.9",
"better-sqlite3": "^11.2.1",
Expand All @@ -90,14 +91,17 @@
"lodash": "^4.17.21",
"mocha": "^10.7.3",
"mysql2": "^3.11.0",
"pathe": "^1.1.2",
"pg": "^8.12.0",
"pg-cursor": "^2.11.0",
"playwright": "^1.46.1",
"prettier": "^3.3.3",
"semver": "^7.6.3",
"sinon": "^18.0.0",
"tarn": "^3.0.2",
"tedious": "^19.0.0",
"tsd": "^0.31.1",
"tsx": "^4.19.1",
"typescript": "^5.6.3"
}
}
22 changes: 22 additions & 0 deletions scripts/exclude-test-files-for-backwards-compat.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { writeFile } from 'node:fs/promises'
import { dirname, resolve } from 'pathe'
import { lt } from 'semver'
import { devDependencies } from '../package.json'

const typescriptVersion = devDependencies.typescript.replace('^', '')
const testTsConfigRelativePath = '../test/node/tsconfig.json'

if (lt(typescriptVersion, '5.0.0')) {
const tsconfig = await import('../test/node/tsconfig.json')

await writeFile(
resolve(
dirname(new URL(import.meta.url).pathname),
testTsConfigRelativePath,
),
JSON.stringify({
...tsconfig,
exclude: [...(tsconfig.exclude || []), 'src/async-dispose.test.ts'],
}),
)
}
Loading

0 comments on commit 93b6ee2

Please sign in to comment.