mysql.test.ts — drizzle-orm Source File
Architecture documentation for mysql.test.ts, a typescript file in the drizzle-orm codebase. 11 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 2e706b35_6579_2240_372e_a930f95218a0["mysql.test.ts"] bcd266b2_f6a8_0abb_2a24_40a68c6f8cc5["mysql-common.ts"] 2e706b35_6579_2240_372e_a930f95218a0 --> bcd266b2_f6a8_0abb_2a24_40a68c6f8cc5 64e47068_0d10_97d9_a217_b4a7be9ca005["createDockerDB"] 2e706b35_6579_2240_372e_a930f95218a0 --> 64e47068_0d10_97d9_a217_b4a7be9ca005 e9ea1e58_4116_09ab_4725_c9e3a74adeb7["tests"] 2e706b35_6579_2240_372e_a930f95218a0 --> e9ea1e58_4116_09ab_4725_c9e3a74adeb7 cccbc47d_c2bb_d1ee_3a7e_546f7279bf7e["mysql-common-cache.ts"] 2e706b35_6579_2240_372e_a930f95218a0 --> cccbc47d_c2bb_d1ee_3a7e_546f7279bf7e 2d9bfa23_6afa_a8eb_f2fb_fdea4578c630["TestCache"] 2e706b35_6579_2240_372e_a930f95218a0 --> 2d9bfa23_6afa_a8eb_f2fb_fdea4578c630 208fff58_f804_2a07_330d_076472ff343f["TestGlobalCache"] 2e706b35_6579_2240_372e_a930f95218a0 --> 208fff58_f804_2a07_330d_076472ff343f 86aa434f_528e_fe0f_107e_2f26b378d3d2["tests"] 2e706b35_6579_2240_372e_a930f95218a0 --> 86aa434f_528e_fe0f_107e_2f26b378d3d2 cad5819d_2851_9c06_9778_62eb6e1b2dab["async-retry"] 2e706b35_6579_2240_372e_a930f95218a0 --> cad5819d_2851_9c06_9778_62eb6e1b2dab da5f49c7_67eb_d6c6_2fa2_c3592f35dc62["mysql2"] 2e706b35_6579_2240_372e_a930f95218a0 --> da5f49c7_67eb_d6c6_2fa2_c3592f35dc62 a340f455_7575_91f4_791a_10cd9b9dba1a["promise"] 2e706b35_6579_2240_372e_a930f95218a0 --> a340f455_7575_91f4_791a_10cd9b9dba1a 8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"] 2e706b35_6579_2240_372e_a930f95218a0 --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686 style 2e706b35_6579_2240_372e_a930f95218a0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import retry from 'async-retry';
import type { MySql2Database } from 'drizzle-orm/mysql2';
import { drizzle } from 'drizzle-orm/mysql2';
import * as mysql from 'mysql2/promise';
import { afterAll, beforeAll, beforeEach } from 'vitest';
import { createDockerDB, tests } from './mysql-common';
import { TestCache, TestGlobalCache, tests as cacheTests } from './mysql-common-cache';
const ENABLE_LOGGING = false;
let db: MySql2Database;
let dbGlobalCached: MySql2Database;
let cachedDb: MySql2Database;
let client: mysql.Connection;
beforeAll(async () => {
let connectionString;
if (process.env['MYSQL_CONNECTION_STRING']) {
connectionString = process.env['MYSQL_CONNECTION_STRING'];
} else {
const { connectionString: conStr } = await createDockerDB();
connectionString = conStr;
}
client = await retry(async () => {
client = await mysql.createConnection({
uri: connectionString!,
supportBigNumbers: true,
});
await client.connect();
return client;
}, {
retries: 20,
factor: 1,
minTimeout: 250,
maxTimeout: 250,
randomize: false,
onRetry() {
client?.end();
},
});
db = drizzle(client, { logger: ENABLE_LOGGING });
cachedDb = drizzle(client, { logger: ENABLE_LOGGING, cache: new TestCache() });
dbGlobalCached = drizzle(client, { logger: ENABLE_LOGGING, cache: new TestGlobalCache() });
});
afterAll(async () => {
await client?.end();
});
beforeEach((ctx) => {
ctx.mysql = {
db,
};
ctx.cachedMySQL = {
db: cachedDb,
dbGlobalCached,
};
});
cacheTests();
tests();
Domain
Dependencies
- TestCache
- TestGlobalCache
- async-retry
- createDockerDB
- mysql-common-cache.ts
- mysql-common.ts
- mysql2
- promise
- tests
- tests
- vitest
Source
Frequently Asked Questions
What does mysql.test.ts do?
mysql.test.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain.
What does mysql.test.ts depend on?
mysql.test.ts imports 11 module(s): TestCache, TestGlobalCache, async-retry, createDockerDB, mysql-common-cache.ts, mysql-common.ts, mysql2, promise, and 3 more.
Where is mysql.test.ts in the architecture?
mysql.test.ts is located at integration-tests/tests/mysql/mysql.test.ts (domain: DrizzleORM, directory: integration-tests/tests/mysql).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free