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