overleaf/services/notifications/test/setup.js

31 lines
760 B
JavaScript
Raw Normal View History

const chai = require('chai')
const SandboxedModule = require('sandboxed-module')
// Chai configuration
chai.should()
// ensure every ObjectId has the id string as a property for correct comparisons
require('mongodb-legacy').ObjectId.cacheHexString = true
// SandboxedModule configuration
SandboxedModule.configure({
requires: {
'@overleaf/logger': {
debug() {},
log() {},
info() {},
warn() {},
err() {},
error() {},
2021-07-13 07:04:44 -04:00
fatal() {},
},
'mongodb-legacy': require('mongodb-legacy'), // for ObjectId comparisons
},
2021-07-13 07:04:44 -04:00
globals: { Buffer, JSON, console, process },
sourceTransformers: {
removeNodePrefix: function (source) {
return source.replace(/require\(['"]node:/g, "require('")
},
},
})