Add a global test setup file

Configure chai and SandboxedModule globally instead of in every test
file. Also add globals that are required for SandboxedModule to work in
Node 12.
This commit is contained in:
Eric Mc Sween
2021-03-16 08:41:46 -04:00
parent 5d4105dcda
commit 5efae3bee6
12 changed files with 71 additions and 79 deletions
@@ -10,11 +10,8 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const SandboxedModule = require('sandboxed-module')
const { assert } = require('chai')
const sinon = require('sinon')
const chai = require('chai')
chai.should()
const { expect } = chai
const { assert, expect } = require('chai')
const modulePath = require('path').join(
__dirname,
'../../../app/js/HttpController'
@@ -30,15 +27,9 @@ describe('HttpController', function () {
requires: {
'./DocManager': (this.DocManager = {}),
'./DocArchiveManager': (this.DocArchiveManager = {}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
error: sinon.stub(),
fatal: sinon.stub()
}),
'settings-sharelatex': settings,
'./HealthChecker': {}
},
globals: { process }
}
})
this.res = {
send: sinon.stub(),