chore(jest): custom db dialect option

This commit is contained in:
chenos 2022-02-15 09:11:00 +08:00
parent 6bf416d5c4
commit 31691e1f8e

View File

@ -1,11 +1,19 @@
import path from 'path';
import dotenv from 'dotenv';
import { existsSync } from 'fs';
import { resolve } from 'path';
import prettyFormat from 'pretty-format';
import yargs from 'yargs';
const envFile = existsSync(resolve(__dirname, '.env.test')) ? '.env.test' : '.env';
dotenv.config({
path: path.resolve(__dirname, process.env.ENV_FILE || '.env'),
path: resolve(__dirname, envFile),
});
if (yargs.argv.dbDialect) {
process.env.DB_DIALECT = yargs.argv.dbDialect as any;
}
global['prettyFormat'] = prettyFormat;
jest.setTimeout(300000);