setup.js 723 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 mongoose = require('mongoose');
  8. const { initMongooseGlobalSettings, getMongoUri, mongoOptions } = require('@growi/core');
  9. mongoose.Promise = global.Promise;
  10. jest.setTimeout(30000); // default 5000
  11. beforeAll(async() => {
  12. initMongooseGlobalSettings();
  13. process.env.MONGO_URI = 'mongodb://mongo/growi_test';
  14. await mongoose.connect(getMongoUri(), mongoOptions);
  15. });
  16. afterAll(async() => {
  17. await mongoose.disconnect();
  18. });
  19. module.exports = {};