| 12345678910111213141516171819202122232425262728293031323334353637 |
- /** **********************************************************
- * Caution
- *
- * Module aliases by compilerOptions.paths in tsconfig.json
- * are NOT available in setup scripts
- *********************************************************** */
- import 'tsconfig-paths/register';
- import mongoose from 'mongoose';
- import { initMongooseGlobalSettings, getMongoUri, mongoOptions } from '@growi/core';
- // check env
- if (process.env.NODE_ENV !== 'test') {
- throw new Error('\'process.env.NODE_ENV\' must be \'test\'');
- }
- // eslint-disable-next-line @typescript-eslint/no-var-requires
- // const { getInstance } = require('./setup-crowi');
- module.exports = async() => {
- initMongooseGlobalSettings();
- await mongoose.connect(getMongoUri(), mongoOptions);
- // drop database
- await mongoose.connection.dropDatabase();
- // init DB
- // const crowi = await getInstance();
- // const appService = crowi.appService;
- // await appService.initDB();
- await mongoose.disconnect();
- };
|