Reintroduce Node 12 and metrics upgrades

These changes were previously merged, not deployed, and reverted. This
reverts the revert.

This reverts commit a6b8c6c658b33b6eee78b8b99e43308f32211ae2, reversing
changes made to 93c98921372eed4244d22fce800716cb27eca299.
This commit is contained in:
Eric Mc Sween
2021-04-01 15:51:00 -04:00
parent 2588c9b87b
commit 4d70bd664f
44 changed files with 1248 additions and 588 deletions
+3
View File
@@ -0,0 +1,3 @@
{
"require": "test/setup.js"
}
+1 -1
View File
@@ -1 +1 @@
10.23.1
12.21.0
+1 -1
View File
@@ -2,7 +2,7 @@
# Instead run bin/update_build_scripts from
# https://github.com/sharelatex/sharelatex-dev-environment
FROM node:10.23.1 as base
FROM node:12.21.0 as base
WORKDIR /app
+4 -2
View File
@@ -21,8 +21,10 @@ DOCKER_COMPOSE_TEST_UNIT = \
COMPOSE_PROJECT_NAME=test_unit_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE)
clean:
docker rmi ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
docker rmi gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
-docker rmi ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
-docker rmi gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
-$(DOCKER_COMPOSE_TEST_UNIT) down --rmi local
-$(DOCKER_COMPOSE_TEST_ACCEPTANCE) down --rmi local
format:
$(DOCKER_COMPOSE) run --rm test_unit npm run --silent format
@@ -706,8 +706,10 @@ const load = function () {
return result
} else if (c1.op.i != null && c2.op.d != null) {
return 1
} else {
} else if (c1.op.d != null && c2.op.i != null) {
return -1
} else {
return 0
}
})
@@ -728,8 +730,10 @@ const load = function () {
return result
} else if (a.i != null && b.d != null) {
return 1
} else {
} else if (a.d != null && b.i != null) {
return -1
} else {
return 0
}
})
+2 -2
View File
@@ -3,6 +3,6 @@ document-updater
--docker-repos=gcr.io/overleaf-ops
--env-add=
--env-pass-through=
--node-version=10.23.1
--node-version=12.21.0
--public-repo=True
--script-version=3.4.0
--script-version=3.7.0
+2 -2
View File
@@ -6,7 +6,7 @@ version: "2.3"
services:
test_unit:
image: node:10.23.1
image: node:12.21.0
volumes:
- .:/app
working_dir: /app
@@ -18,7 +18,7 @@ services:
user: node
test_acceptance:
image: node:10.23.1
image: node:12.21.0
volumes:
- .:/app
working_dir: /app
+1167 -416
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -18,7 +18,7 @@
"format:fix": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --write"
},
"dependencies": {
"@overleaf/metrics": "^3.4.1",
"@overleaf/metrics": "^3.5.1",
"@overleaf/o-error": "^3.1.0",
"@overleaf/redis-wrapper": "^2.0.0",
"async": "^2.5.0",
@@ -36,8 +36,8 @@
"devDependencies": {
"babel-eslint": "^10.1.0",
"chai": "^3.5.0",
"chai-spies": "^0.7.1",
"cluster-key-slot": "^1.0.5",
"coffee-script": "^1.12.7",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-config-standard": "^14.1.0",
@@ -53,10 +53,10 @@
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-standard": "^4.0.1",
"mocha": "^5.0.1",
"mocha": "^8.3.2",
"prettier": "^2.0.0",
"prettier-eslint-cli": "^5.0.0",
"sandboxed-module": "~0.2.0",
"sandboxed-module": "^2.0.4",
"sinon": "^9.0.2",
"timekeeper": "^2.0.0"
}
@@ -12,9 +12,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
chai.should()
const { expect } = chai
const { expect } = require('chai')
const async = require('async')
const Settings = require('settings-sharelatex')
const rclient_history = require('@overleaf/redis-wrapper').createClient(
@@ -1,6 +1,4 @@
const sinon = require('sinon')
const chai = require('chai')
chai.should()
const Settings = require('settings-sharelatex')
const rclientProjectHistory = require('@overleaf/redis-wrapper').createClient(
Settings.redis.project_history
@@ -11,9 +11,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
chai.should()
const MockTrackChangesApi = require('./helpers/MockTrackChangesApi')
const MockProjectHistoryApi = require('./helpers/MockProjectHistoryApi')
const MockWebApi = require('./helpers/MockWebApi')
@@ -12,8 +12,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
chai.should()
const async = require('async')
const MockTrackChangesApi = require('./helpers/MockTrackChangesApi')
@@ -12,8 +12,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
chai.should()
const async = require('async')
const MockWebApi = require('./helpers/MockWebApi')
@@ -14,9 +14,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
chai.should()
const { expect } = chai
const { expect } = require('chai')
const async = require('async')
const MockWebApi = require('./helpers/MockWebApi')
@@ -12,9 +12,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
chai.should()
const { expect } = chai
const { expect } = require('chai')
const MockWebApi = require('./helpers/MockWebApi')
const DocUpdaterClient = require('./helpers/DocUpdaterClient')
@@ -12,9 +12,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
chai.should()
const { expect } = chai
const { expect } = require('chai')
const MockWebApi = require('./helpers/MockWebApi')
const DocUpdaterClient = require('./helpers/DocUpdaterClient')
@@ -12,9 +12,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
chai.should()
const { expect } = chai
const { expect } = require('chai')
const async = require('async')
const { db, ObjectId } = require('../../../app/js/mongodb')
@@ -1,6 +1,4 @@
const sinon = require('sinon')
const chai = require('chai')
chai.should()
const { expect } = require('chai')
const Settings = require('settings-sharelatex')
const docUpdaterRedis = require('@overleaf/redis-wrapper').createClient(
+37
View File
@@ -0,0 +1,37 @@
const chai = require('chai')
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
// Chai configuration
chai.should()
// Global stubs
const sandbox = sinon.createSandbox()
const stubs = {
logger: {
debug: sandbox.stub(),
log: sandbox.stub(),
warn: sandbox.stub(),
err: sandbox.stub(),
error: sandbox.stub()
}
}
// SandboxedModule configuration
SandboxedModule.configure({
requires: {
'logger-sharelatex': stubs.logger
},
globals: { Buffer, JSON, Math, console, process }
})
// Mocha hooks
exports.mochaHooks = {
beforeEach() {
this.logger = stubs.logger
},
afterEach() {
sandbox.reset()
}
}
@@ -11,9 +11,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const { expect } = chai
const { expect } = require('chai')
const modulePath = '../../../../app/js/DiffCodec.js'
const SandboxedModule = require('sandboxed-module')
@@ -12,8 +12,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const modulePath = '../../../../app/js/DispatchManager.js'
const SandboxedModule = require('sandboxed-module')
const Errors = require('../../../../app/js/Errors.js')
@@ -25,11 +23,6 @@ describe('DispatchManager', function () {
this.DispatchManager = SandboxedModule.require(modulePath, {
requires: {
'./UpdateManager': (this.UpdateManager = {}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
error: sinon.stub(),
warn: sinon.stub()
}),
'settings-sharelatex': (this.settings = {
redis: {
documentupdater: {}
@@ -13,8 +13,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const modulePath = '../../../../app/js/DocumentManager.js'
const SandboxedModule = require('sandboxed-module')
const Errors = require('../../../../app/js/Errors')
@@ -33,11 +31,6 @@ describe('DocumentManager', function () {
flushDocChangesAsync: sinon.stub(),
flushProjectChangesAsync: sinon.stub()
}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
warn: sinon.stub()
}),
'./DocOpsManager': (this.DocOpsManager = {}),
'./Metrics': (this.Metrics = {
Timer: (Timer = (function () {
Timer = class Timer {
@@ -220,7 +213,6 @@ describe('DocumentManager', function () {
.stub()
.callsArgWith(2, null, null, null, null)
this.PersistenceManager.setDoc = sinon.stub().yields()
this.DocOpsManager.flushDocOpsToMongo = sinon.stub().callsArgWith(2)
return this.DocumentManager.flushDocIfLoaded(
this.project_id,
this.doc_id,
@@ -236,7 +228,6 @@ describe('DocumentManager', function () {
it('should not write anything to the persistence layer', function () {
this.PersistenceManager.setDoc.called.should.equal(false)
return this.DocOpsManager.flushDocOpsToMongo.called.should.equal(false)
})
it('should call the callback without error', function () {
@@ -11,7 +11,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
const modulePath = require('path').join(
__dirname,
'../../../../app/js/HistoryManager'
@@ -33,11 +32,6 @@ describe('HistoryManager', function () {
}
}
}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
error: sinon.stub(),
debug: sinon.stub()
}),
'./DocumentManager': (this.DocumentManager = {}),
'./HistoryRedisManager': (this.HistoryRedisManager = {}),
'./RedisManager': (this.RedisManager = {}),
@@ -12,8 +12,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const modulePath = '../../../../app/js/HistoryRedisManager.js'
const SandboxedModule = require('sandboxed-module')
const Errors = require('../../../../app/js/Errors')
@@ -41,8 +39,7 @@ describe('HistoryRedisManager', function () {
}
})
}
},
'logger-sharelatex': { log() {} }
}
}
})
this.doc_id = 'doc-id-123'
@@ -12,7 +12,6 @@ describe('HttpController', function () {
flushProjectChangesAsync: sinon.stub()
}),
'./ProjectManager': (this.ProjectManager = {}),
'logger-sharelatex': (this.logger = { log: sinon.stub() }),
'./ProjectFlusher': { flushAllProjects() {} },
'./DeleteQueueManager': (this.DeleteQueueManager = {}),
'./Metrics': (this.Metrics = {}),
@@ -25,7 +25,6 @@ describe('LockManager - checking the lock', function () {
const existsStub = sinon.stub()
const mocks = {
'logger-sharelatex': { log() {} },
'@overleaf/redis-wrapper': {
createClient() {
return {
@@ -27,10 +27,6 @@ describe('LockManager - releasing the lock', function () {
eval: sinon.stub()
}
const mocks = {
'logger-sharelatex': {
log() {},
error() {}
},
'@overleaf/redis-wrapper': {
createClient: () => this.client
},
@@ -15,8 +15,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const modulePath = '../../../../app/js/LockManager.js'
const SandboxedModule = require('sandboxed-module')
@@ -25,7 +23,6 @@ describe('LockManager - getting the lock', function () {
let Profiler
this.LockManager = SandboxedModule.require(modulePath, {
requires: {
'logger-sharelatex': { log() {} },
'@overleaf/redis-wrapper': {
createClient: () => {
return { auth() {} }
@@ -12,8 +12,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const modulePath = '../../../../app/js/LockManager.js'
const SandboxedModule = require('sandboxed-module')
@@ -22,7 +20,6 @@ describe('LockManager - trying the lock', function () {
let Profiler
this.LockManager = SandboxedModule.require(modulePath, {
requires: {
'logger-sharelatex': { log() {} },
'@overleaf/redis-wrapper': {
createClient: () => {
return {
@@ -11,8 +11,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const modulePath = '../../../../app/js/PersistenceManager.js'
const SandboxedModule = require('sandboxed-module')
const Errors = require('../../../../app/js/Errors')
@@ -38,11 +36,6 @@ describe('PersistenceManager', function () {
})()),
inc: sinon.stub()
}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
err: sinon.stub(),
error: sinon.stub()
}),
'./Errors': Errors
}
})
@@ -12,8 +12,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const modulePath = '../../../../app/js/ProjectHistoryRedisManager.js'
const SandboxedModule = require('sandboxed-module')
const tk = require('timekeeper')
@@ -47,13 +45,7 @@ describe('ProjectHistoryRedisManager', function () {
'@overleaf/redis-wrapper': {
createClient: () => this.rclient
},
'logger-sharelatex': {
log() {}
},
'./Metrics': (this.metrics = { summary: sinon.stub() })
},
globals: {
JSON: (this.JSON = JSON)
}
}
))
@@ -136,7 +128,7 @@ describe('ProjectHistoryRedisManager', function () {
return this.ProjectHistoryRedisManager.queueOps
.calledWithExactly(
this.project_id,
this.JSON.stringify(update),
JSON.stringify(update),
this.callback
)
.should.equal(true)
@@ -184,7 +176,7 @@ describe('ProjectHistoryRedisManager', function () {
return this.ProjectHistoryRedisManager.queueOps
.calledWithExactly(
this.project_id,
this.JSON.stringify(update),
JSON.stringify(update),
this.callback
)
.should.equal(true)
@@ -13,8 +13,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const modulePath = '../../../../app/js/ProjectManager.js'
const SandboxedModule = require('sandboxed-module')
@@ -26,10 +24,6 @@ describe('ProjectManager - flushAndDeleteProject', function () {
'./RedisManager': (this.RedisManager = {}),
'./ProjectHistoryRedisManager': (this.ProjectHistoryRedisManager = {}),
'./DocumentManager': (this.DocumentManager = {}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
error: sinon.stub()
}),
'./HistoryManager': (this.HistoryManager = {
flushProjectChanges: sinon.stub().callsArg(2)
}),
@@ -15,8 +15,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const modulePath = '../../../../app/js/ProjectManager.js'
const SandboxedModule = require('sandboxed-module')
@@ -28,10 +26,6 @@ describe('ProjectManager - flushProject', function () {
'./RedisManager': (this.RedisManager = {}),
'./ProjectHistoryRedisManager': (this.ProjectHistoryRedisManager = {}),
'./DocumentManager': (this.DocumentManager = {}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
error: sinon.stub()
}),
'./HistoryManager': (this.HistoryManager = {}),
'./Metrics': (this.Metrics = {
Timer: (Timer = (function () {
@@ -11,8 +11,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const modulePath = '../../../../app/js/ProjectManager.js'
const SandboxedModule = require('sandboxed-module')
const Errors = require('../../../../app/js/Errors.js')
@@ -25,10 +23,6 @@ describe('ProjectManager - getProjectDocsAndFlushIfOld', function () {
'./RedisManager': (this.RedisManager = {}),
'./ProjectHistoryRedisManager': (this.ProjectHistoryRedisManager = {}),
'./DocumentManager': (this.DocumentManager = {}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
error: sinon.stub()
}),
'./HistoryManager': (this.HistoryManager = {}),
'./Metrics': (this.Metrics = {
Timer: (Timer = (function () {
@@ -22,17 +22,11 @@ describe('ProjectManager', function () {
}
this.Metrics.Timer.prototype.done = sinon.stub()
this.logger = {
log: sinon.stub(),
error: sinon.stub()
}
this.ProjectManager = SandboxedModule.require(modulePath, {
requires: {
'./RedisManager': this.RedisManager,
'./ProjectHistoryRedisManager': this.ProjectHistoryRedisManager,
'./DocumentManager': this.DocumentManager,
'logger-sharelatex': this.logger,
'./HistoryManager': this.HistoryManager,
'./Metrics': this.Metrics
}
@@ -13,23 +13,13 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const { expect } = chai
const { expect } = require('chai')
const modulePath = '../../../../app/js/RangesManager.js'
const SandboxedModule = require('sandboxed-module')
describe('RangesManager', function () {
beforeEach(function () {
this.RangesManager = SandboxedModule.require(modulePath, {
requires: {
'logger-sharelatex': (this.logger = {
error: sinon.stub(),
log: sinon.stub(),
warn: sinon.stub()
})
}
})
this.RangesManager = SandboxedModule.require(modulePath)
this.doc_id = 'doc-id-123'
this.project_id = 'project-id-123'
@@ -368,11 +358,6 @@ describe('RangesManager', function () {
beforeEach(function () {
this.RangesManager = SandboxedModule.require(modulePath, {
requires: {
'logger-sharelatex': (this.logger = {
error: sinon.stub(),
log: sinon.stub(),
warn: sinon.stub()
}),
'./RangesTracker': (this.RangesTracker = SandboxedModule.require(
'../../../../app/js/RangesTracker.js'
))
@@ -11,9 +11,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const { expect } = chai
const { expect } = require('chai')
const modulePath = '../../../../app/js/RateLimitManager.js'
const SandboxedModule = require('sandboxed-module')
@@ -22,7 +20,6 @@ describe('RateLimitManager', function () {
let Timer
this.RateLimitManager = SandboxedModule.require(modulePath, {
requires: {
'logger-sharelatex': (this.logger = { log: sinon.stub() }),
'settings-sharelatex': (this.settings = {}),
'./Metrics': (this.Metrics = {
Timer: (Timer = (function () {
@@ -11,8 +11,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const modulePath = '../../../../app/js/RealTimeRedisManager.js'
const SandboxedModule = require('sandboxed-module')
const Errors = require('../../../../app/js/Errors')
@@ -45,7 +43,6 @@ describe('RealTimeRedisManager', function () {
}
}
},
'logger-sharelatex': { log() {} },
crypto: (this.crypto = {
randomBytes: sinon
.stub()
@@ -12,8 +12,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const modulePath = '../../../../app/js/RedisManager.js'
const SandboxedModule = require('sandboxed-module')
const Errors = require('../../../../app/js/Errors')
@@ -28,11 +26,6 @@ describe('RedisManager', function () {
tk.freeze(new Date())
this.RedisManager = SandboxedModule.require(modulePath, {
requires: {
'logger-sharelatex': (this.logger = {
error: sinon.stub(),
log: sinon.stub(),
warn: sinon.stub()
}),
'./ProjectHistoryRedisManager': (this.ProjectHistoryRedisManager = {}),
'settings-sharelatex': (this.settings = {
documentupdater: { logHashErrors: { write: true, read: true } },
@@ -122,9 +115,6 @@ describe('RedisManager', function () {
})
}),
'./Errors': Errors
},
globals: {
JSON: (this.JSON = JSON)
}
})
@@ -924,8 +914,9 @@ describe('RedisManager', function () {
this.RedisManager.getDocVersion
.withArgs(this.doc_id)
.yields(null, this.version - this.ops.length)
this._stringify = JSON.stringify
this.JSON.stringify = () => '["bad bytes! \u0000 <- here"]'
this.stringifyStub = sinon
.stub(JSON, 'stringify')
.callsFake(() => '["bad bytes! \u0000 <- here"]')
return this.RedisManager.updateDocument(
this.project_id,
this.doc_id,
@@ -939,7 +930,7 @@ describe('RedisManager', function () {
})
afterEach(function () {
return (this.JSON.stringify = this._stringify)
this.stringifyStub.restore()
})
it('should log an error', function () {
@@ -1127,8 +1118,9 @@ describe('RedisManager', function () {
describe('with null bytes in the serialized doc lines', function () {
beforeEach(function () {
this._stringify = JSON.stringify
this.JSON.stringify = () => '["bad bytes! \u0000 <- here"]'
this.stringifyStub = sinon
.stub(JSON, 'stringify')
.callsFake(() => '["bad bytes! \u0000 <- here"]')
return this.RedisManager.putDocInMemory(
this.project_id,
this.doc_id,
@@ -1142,7 +1134,7 @@ describe('RedisManager', function () {
})
afterEach(function () {
return (this.JSON.stringify = this._stringify)
this.stringifyStub.restore()
})
it('should log an error', function () {
@@ -14,7 +14,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const text = require('../../../../app/js/sharejs/types/text')
require('chai').should()
const RangesTracker = require('../../../../app/js/RangesTracker')
describe('ShareJS text type', function () {
@@ -11,9 +11,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const { expect } = chai
const { expect } = require('chai')
const modulePath = '../../../../app/js/ShareJsDB.js'
const SandboxedModule = require('sandboxed-module')
const Errors = require('../../../../app/js/Errors')
@@ -10,8 +10,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const modulePath = '../../../../app/js/ShareJsUpdateManager.js'
const SandboxedModule = require('sandboxed-module')
const crypto = require('crypto')
@@ -35,7 +33,6 @@ describe('ShareJsUpdateManager', function () {
return (this.rclient = { auth() {} })
}
},
'logger-sharelatex': (this.logger = { log: sinon.stub() }),
'./RealTimeRedisManager': (this.RealTimeRedisManager = {}),
'./Metrics': (this.metrics = { inc: sinon.stub() })
},
@@ -12,8 +12,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const modulePath = '../../../../app/js/UpdateManager.js'
const SandboxedModule = require('sandboxed-module')
@@ -31,7 +29,6 @@ describe('UpdateManager', function () {
'./RealTimeRedisManager': (this.RealTimeRedisManager = {}),
'./ShareJsUpdateManager': (this.ShareJsUpdateManager = {}),
'./HistoryManager': (this.HistoryManager = {}),
'logger-sharelatex': (this.logger = { log: sinon.stub() }),
'./Metrics': (this.Metrics = {
Timer: (Timer = (function () {
Timer = class Timer {