setup.js 684 B

12345678910111213141516171819202122232425
  1. /** **********************************************************
  2. * Caution
  3. *
  4. * Module aliases by compilerOptions.paths in tsconfig.json
  5. * are NOT available in setup scripts
  6. *********************************************************** */
  7. const mongoose = require('mongoose');
  8. const { initMongooseGlobalSettings, getMongoUri, mongoOptions } = require('~/server/util/mongoose-utils');
  9. mongoose.Promise = global.Promise;
  10. jest.setTimeout(30000); // default 5000
  11. beforeAll(async() => {
  12. initMongooseGlobalSettings();
  13. await mongoose.connect(getMongoUri(), mongoOptions);
  14. });
  15. afterAll(async() => {
  16. await mongoose.disconnect();
  17. });
  18. module.exports = {};