Skip to content

Commit 3fac885

Browse files
author
Mitchell Elholm
committed
Fix integration test on Sequelize
1 parent 3bd6df7 commit 3fac885

5 files changed

Lines changed: 26 additions & 11 deletions

File tree

.github/workflows/typescript-sequelize-integ-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ jobs:
5252
env:
5353
CLUSTER_ENDPOINT: ${{ secrets.TYPESCRIPT_SEQUELIZE_CLUSTER_ENDPOINT}}
5454
REGION: ${{ secrets.TYPESCRIPT_SEQUELIZE_CLUSTER_REGION}}
55+
CLUSTER_USER: 'admin'
5556
run: |
5657
npm install
5758
npm run test

typescript/sequelize/package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
"version": "1.0.0",
44
"description": "How To",
55
"main": "index.js",
6-
"type": "module",
6+
"type": "commonjs",
77
"scripts": {
88
"build": "tsc",
9-
"start": "node dist/index.js",
10-
"dev": "npm run build && npm run start"
9+
"clean": "rm -rf build && rm -rf dist",
10+
"start": "node dist/src/index.js",
11+
"dev": "npm run clean && npm run build && npm run start",
12+
"test": "npm run clean && npm run build && jest dist/test"
1113
},
1214
"dependencies": {
1315
"@aws-sdk/dsql-signer": "^3.705.0",
@@ -17,6 +19,8 @@
1719
"sequelize": "^6.37.5"
1820
},
1921
"devDependencies": {
22+
"@types/jest": "^29.5.14",
23+
"jest": "^29.7.0",
2024
"typescript": "^5.0.0"
2125
}
2226
}

typescript/sequelize/src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,11 @@ async function retryExample() {
308308
await sequelize.close();
309309
}
310310

311-
async function runExamples() {
311+
export async function runExamples() {
312312
await sequelizeExample();
313313
await retryExample();
314314
}
315315

316-
runExamples()
316+
if (require.main === module) {
317+
runExamples().catch(console.error);
318+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { runExamples } from "../src/index.js"
2+
3+
const SECONDS = 1000;
4+
5+
describe("Index module", () => {
6+
test("Runs all the example code", async () => {
7+
await runExamples();
8+
}, 60 * SECONDS)
9+
})

typescript/sequelize/tsconfig.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
{
22
"compilerOptions": {
3-
"target": "es2016",
4-
"module": "ES2020",
5-
"moduleResolution": "node",
3+
"target": "ES6",
4+
"module": "node16",
5+
"moduleResolution": "node16",
66
"forceConsistentCasingInFileNames": true,
77
"strict": true,
88
"skipLibCheck": true,
9-
"outDir": "./dist",
10-
"rootDir": "./src",
9+
"outDir": "dist",
1110
},
12-
"include" : ["src/**/*"]
11+
"include" : ["src/**/*", "test/**/*"]
1312
}

0 commit comments

Comments
 (0)