Skip to content

Commit 3c31643

Browse files
committed
add force exist jest
1 parent 1484f6b commit 3c31643

File tree

4 files changed

+23
-21
lines changed

4 files changed

+23
-21
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"prepack": "npm run build",
1818
"prepare": "husky install",
1919
"test": "jest --verbose --testPathPattern=unit",
20-
"test:connection": "jest --verbose --testPathPattern=connection --runInBand",
20+
"test:connection": "jest --verbose --testPathPattern=connection --runInBand --forceExit",
2121
"test:watch": "jest --watch",
2222
"test:coverage": "jest --coverage --testPathPattern=unit"
2323
},

src/connections/mysql.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ export function buildMySQLDatabaseSchmea({
127127

128128
columnLookup[
129129
column.TABLE_SCHEMA +
130-
'.' +
131-
column.TABLE_NAME +
132-
'.' +
133-
column.COLUMN_NAME
130+
'.' +
131+
column.TABLE_NAME +
132+
'.' +
133+
column.COLUMN_NAME
134134
] = columnObject;
135135

136136
table.columns.push(columnObject);
@@ -156,10 +156,10 @@ export function buildMySQLDatabaseSchmea({
156156

157157
constraintLookup[
158158
constraint.TABLE_SCHEMA +
159-
'.' +
160-
constraint.TABLE_NAME +
161-
'.' +
162-
constraint.CONSTRAINT_NAME
159+
'.' +
160+
constraint.TABLE_NAME +
161+
'.' +
162+
constraint.CONSTRAINT_NAME
163163
] = constraintObject;
164164

165165
table.constraints.push(constraintObject);
@@ -169,22 +169,22 @@ export function buildMySQLDatabaseSchmea({
169169
for (const constraintColumn of constraintColumnsList) {
170170
const constraint =
171171
constraintLookup[
172-
constraintColumn.TABLE_SCHEMA +
173-
'.' +
174-
constraintColumn.TABLE_NAME +
175-
'.' +
176-
constraintColumn.CONSTRAINT_NAME
172+
constraintColumn.TABLE_SCHEMA +
173+
'.' +
174+
constraintColumn.TABLE_NAME +
175+
'.' +
176+
constraintColumn.CONSTRAINT_NAME
177177
];
178178

179179
if (!constraint) continue;
180180

181181
const currentColumn =
182182
columnLookup[
183-
constraintColumn.TABLE_SCHEMA +
184-
'.' +
185-
constraintColumn.TABLE_NAME +
186-
'.' +
187-
constraintColumn.COLUMN_NAME
183+
constraintColumn.TABLE_SCHEMA +
184+
'.' +
185+
constraintColumn.TABLE_NAME +
186+
'.' +
187+
constraintColumn.COLUMN_NAME
188188
];
189189
if (currentColumn && constraintColumn.REFERENCED_COLUMN_NAME) {
190190
currentColumn.definition.references = {
@@ -377,7 +377,7 @@ export class MySQLConnection extends SqlConnection {
377377
);
378378
}
379379

380-
async connect(): Promise<any> {}
380+
async connect(): Promise<any> { }
381381
async disconnect(): Promise<any> {
382382
this.conn.destroy();
383383
}

tests/connections/connection.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ beforeAll(async () => {
1010

1111
// Clean up all tables
1212
const schemaList = await db.fetchDatabaseSchema();
13-
const currentSchema = schemaList[DEFAULT_SCHEMA];
13+
const currentSchema = schemaList[DEFAULT_SCHEMA] ?? {};
1414

1515
for (const table of Object.values(currentSchema)) {
1616
await db.dropTable(DEFAULT_SCHEMA, table.name)

tests/connections/postgres.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import createTestClient from './create-test-connection';
22
const { client: db, defaultSchema: DEFAULT_SCHEMA } = createTestClient();
33

44
beforeAll(async () => {
5+
if (process.env.CONNECTION_TYPE !== 'postgres') return;
56
await db.connect();
67
});
78

89
afterAll(async () => {
10+
if (process.env.CONNECTION_TYPE !== 'postgres') return;
911
await db.disconnect();
1012
});
1113

0 commit comments

Comments
 (0)