setup.js 570 B

123456789101112131415161718192021222324252627
  1. import { afterEach, chai, vi } from 'vitest'
  2. import mongodb from 'mongodb-legacy'
  3. import chaiAsPromised from 'chai-as-promised'
  4. // Chai configuration
  5. chai.should()
  6. chai.use(chaiAsPromised)
  7. // ensure every ObjectId has the id string as a property for correct comparisons
  8. mongodb.ObjectId.cacheHexString = true
  9. vi.mock('@overleaf/logger', () => ({
  10. default: {
  11. debug: vi.fn(),
  12. log: vi.fn(),
  13. info: vi.fn(),
  14. warn: vi.fn(),
  15. err: vi.fn(),
  16. error: vi.fn(),
  17. fatal: vi.fn(),
  18. },
  19. }))
  20. afterEach(() => {
  21. vi.restoreAllMocks()
  22. vi.resetModules()
  23. })