setup-crowi.js 402 B

12345678910111213141516171819202122
  1. import Crowi from '~/server/crowi';
  2. let _instance = null;
  3. async function getInstance(isNewInstance) {
  4. if (isNewInstance) {
  5. const crowi = new Crowi();
  6. await crowi.initForTest();
  7. return crowi;
  8. }
  9. // initialize singleton instance
  10. if (_instance == null) {
  11. _instance = new Crowi();
  12. await _instance.initForTest();
  13. }
  14. return _instance;
  15. }
  16. module.exports = {
  17. getInstance,
  18. };