2022-11-10 07:06:26 -05:00
|
|
|
const SandboxedModule = require('sandboxed-module')
|
2020-07-02 09:19:45 -04:00
|
|
|
const chai = require('chai')
|
2024-09-23 07:09:32 -04:00
|
|
|
const sinon = require('sinon')
|
2022-11-10 07:06:26 -05:00
|
|
|
|
2020-07-02 09:19:45 -04:00
|
|
|
chai.use(require('sinon-chai'))
|
|
|
|
chai.use(require('chai-as-promised'))
|
2022-11-10 07:06:26 -05:00
|
|
|
|
|
|
|
SandboxedModule.configure({
|
2024-09-23 07:09:32 -04:00
|
|
|
requires: {
|
|
|
|
'@overleaf/logger': {
|
|
|
|
debug() {},
|
|
|
|
log() {},
|
|
|
|
info() {},
|
|
|
|
warn() {},
|
|
|
|
error() {},
|
|
|
|
err() {},
|
|
|
|
},
|
|
|
|
'@overleaf/metrics': {
|
|
|
|
inc: sinon.stub(),
|
|
|
|
count: sinon.stub(),
|
|
|
|
histogram: sinon.stub(),
|
|
|
|
Timer: class Timer {
|
|
|
|
done() {}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2023-09-07 07:57:11 -04:00
|
|
|
globals: { Buffer, Math, console, process, URL },
|
2024-11-08 05:21:56 -05:00
|
|
|
sourceTransformers: {
|
|
|
|
removeNodePrefix: function (source) {
|
|
|
|
return source.replace(/require\(['"]node:/g, "require('")
|
|
|
|
},
|
|
|
|
},
|
2022-11-10 07:06:26 -05:00
|
|
|
})
|