mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #184 from sharelatex/fix-leak-in-smoke-tests
port leak fixes from smoke-test-sharelatex module
This commit is contained in:
commit
a715d60e1c
2 changed files with 10 additions and 1 deletions
|
@ -15,7 +15,16 @@ module.exports = HealthCheckController =
|
|||
mocha = new Mocha(reporter: Reporter(res), timeout: 10000)
|
||||
mocha.addFile("test/smoke/js/SmokeTests.js")
|
||||
mocha.run () ->
|
||||
# TODO: combine this with the smoke-test-sharelatex module
|
||||
# we need to clean up all references to the smokeTest module
|
||||
# so it can be garbage collected. The only reference should
|
||||
# be in its parent, when it is loaded by mocha.addFile.
|
||||
path = require.resolve(__dirname + "/../../../../test/smoke/js/SmokeTests.js")
|
||||
smokeTestModule = require.cache[path]
|
||||
parent = smokeTestModule.parent
|
||||
while (idx = parent.children.indexOf(smokeTestModule)) != -1
|
||||
parent.children.splice(idx, 1)
|
||||
# remove the smokeTest from the module cache
|
||||
delete require.cache[path]
|
||||
|
||||
checkRedis: (req, res, next)->
|
||||
|
|
|
@ -2,7 +2,7 @@ child = require "child_process"
|
|||
fs = require "fs"
|
||||
assert = require("assert")
|
||||
chai = require("chai")
|
||||
chai.should()
|
||||
chai.should() unless Object.prototype.should?
|
||||
expect = chai.expect
|
||||
Settings = require "settings-sharelatex"
|
||||
port = Settings.internal?.web?.port or Settings.port or 3000
|
||||
|
|
Loading…
Reference in a new issue