setup.js 618 B

12345678910111213141516171819202122232425
  1. const chai = require('chai')
  2. const SandboxedModule = require('sandboxed-module')
  3. // Chai configuration
  4. chai.should()
  5. // ensure every ObjectId has the id string as a property for correct comparisons
  6. require('mongodb-legacy').ObjectId.cacheHexString = true
  7. // SandboxedModule configuration
  8. SandboxedModule.configure({
  9. requires: {
  10. '@overleaf/logger': {
  11. debug() {},
  12. log() {},
  13. info() {},
  14. warn() {},
  15. err() {},
  16. error() {},
  17. fatal() {},
  18. },
  19. 'mongodb-legacy': require('mongodb-legacy'), // for ObjectId comparisons
  20. },
  21. globals: { Buffer, JSON, console, process },
  22. })