setup.js 674 B

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