Merge pull request #214 from overleaf/em-upgrade-node-12

Upgrade to Node 12
This commit is contained in:
Eric Mc Sween 2021-03-16 08:37:26 -04:00 committed by GitHub
commit 0e1da3fd0d
33 changed files with 39 additions and 87 deletions

View file

@ -8,3 +8,4 @@ nodemon.json
cache/
compiles/
db/
output/

View file

@ -0,0 +1,3 @@
{
"require": "test/setup.js"
}

View file

@ -1 +1 @@
10.23.1
12.21.0

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
COPY install_deps.sh /app
@ -23,6 +23,6 @@ FROM base
COPY --from=app /app /app
RUN mkdir -p cache compiles db output \
&& chown node:node cache compiles db output
&& chown node:node cache compiles db output
CMD ["node", "--expose-gc", "app.js"]

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

View file

@ -1,9 +1,9 @@
clsi
--data-dirs=cache,compiles,db
--data-dirs=cache,compiles,db,output
--dependencies=
--docker-repos=gcr.io/overleaf-ops
--env-add=
--env-pass-through=TEXLIVE_IMAGE
--node-version=10.23.1
--node-version=12.21.0
--public-repo=True
--script-version=3.4.0
--script-version=3.7.0

View file

@ -10,7 +10,6 @@
*/
const Client = require('./helpers/Client')
const request = require('request')
require('chai').should()
const ClsiApp = require('./helpers/ClsiApp')
describe('Broken LaTeX file', function () {

View file

@ -10,7 +10,6 @@
*/
const Client = require('./helpers/Client')
const request = require('request')
require('chai').should()
const ClsiApp = require('./helpers/ClsiApp')
describe('Deleting Old Files', function () {

View file

@ -17,7 +17,6 @@
*/
const Client = require('./helpers/Client')
const request = require('request')
require('chai').should()
const fs = require('fs')
const fsExtra = require('fs-extra')
const ChildProcess = require('child_process')

View file

@ -10,7 +10,6 @@
*/
const Client = require('./helpers/Client')
const request = require('request')
require('chai').should()
const ClsiApp = require('./helpers/ClsiApp')
describe('Simple LaTeX file', function () {

View file

@ -11,7 +11,6 @@
*/
const Client = require('./helpers/Client')
const request = require('request')
require('chai').should()
const { expect } = require('chai')
const ClsiApp = require('./helpers/ClsiApp')
const crypto = require('crypto')

View file

@ -10,7 +10,6 @@
*/
const Client = require('./helpers/Client')
const request = require('request')
require('chai').should()
const ClsiApp = require('./helpers/ClsiApp')
describe('Timed out compile', function () {

View file

@ -11,7 +11,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const Client = require('./helpers/Client')
require('chai').should()
const sinon = require('sinon')
const ClsiApp = require('./helpers/ClsiApp')

View file

@ -11,7 +11,6 @@
*/
const Client = require('./helpers/Client')
const request = require('request')
require('chai').should()
const { expect } = require('chai')
const path = require('path')
const fs = require('fs')

View file

@ -0,0 +1,19 @@
const chai = require('chai')
const SandboxedModule = require('sandboxed-module')
// Setup should interface
chai.should()
// Global SandboxedModule settings
SandboxedModule.configure({
requires: {
'logger-sharelatex': {
log() {},
info() {},
warn() {},
error() {},
err() {}
}
},
globals: { Buffer, console, process }
})

View file

@ -11,7 +11,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
const { expect } = require('chai')
const modulePath = require('path').join(
__dirname,
@ -32,13 +31,7 @@ describe('CompileController', function () {
}
}
}),
'./ProjectPersistenceManager': (this.ProjectPersistenceManager = {}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
error: sinon.stub(),
err: sinon.stub(),
warn: sinon.stub()
})
'./ProjectPersistenceManager': (this.ProjectPersistenceManager = {})
}
})
this.Settings.externalUrl = 'http://www.example.com'

View file

@ -15,7 +15,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
const modulePath = require('path').join(
__dirname,
'../../../app/js/CompileManager'
@ -47,7 +46,6 @@ describe('CompileManager', function () {
}
}),
'logger-sharelatex': (this.logger = { log: sinon.stub(), info() {} }),
child_process: (this.child_process = {}),
'./CommandRunner': (this.CommandRunner = {}),
'./DraftModeManager': (this.DraftModeManager = {}),

View file

@ -12,7 +12,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
const modulePath = require('path').join(
__dirname,
'../../../app/js/ContentTypeMapper'

View file

@ -11,7 +11,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
const modulePath = require('path').join(
__dirname,
'../../../app/js/DockerLockManager'
@ -21,11 +20,7 @@ describe('LockManager', function () {
beforeEach(function () {
return (this.LockManager = SandboxedModule.require(modulePath, {
requires: {
'settings-sharelatex': (this.Settings = { clsi: { docker: {} } }),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
error: sinon.stub()
})
'settings-sharelatex': (this.Settings = { clsi: { docker: {} } })
}
}))
})

View file

@ -15,7 +15,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
const { expect } = require('chai')
const modulePath = require('path').join(
__dirname,
@ -33,12 +32,6 @@ describe('DockerRunner', function () {
clsi: { docker: {} },
path: {}
}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
error: sinon.stub(),
info: sinon.stub(),
warn: sinon.stub()
}),
dockerode: (Docker = (function () {
Docker = class Docker {
static initClass() {

View file

@ -10,7 +10,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
const modulePath = require('path').join(
__dirname,
'../../../app/js/DraftModeManager'
@ -20,8 +19,7 @@ describe('DraftModeManager', function () {
beforeEach(function () {
return (this.DraftModeManager = SandboxedModule.require(modulePath, {
requires: {
fs: (this.fs = {}),
'logger-sharelatex': (this.logger = { log() {} })
fs: (this.fs = {})
}
}))
})

View file

@ -11,7 +11,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
const modulePath = require('path').join(
__dirname,
'../../../app/js/LatexRunner'
@ -28,10 +27,6 @@ describe('LatexRunner', function () {
socketPath: '/var/run/docker.sock'
}
}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
error: sinon.stub()
}),
'./Metrics': {
Timer: (Timer = class Timer {
done() {}

View file

@ -11,7 +11,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
const modulePath = require('path').join(
__dirname,
'../../../app/js/LockManager'
@ -24,11 +23,6 @@ describe('DockerLockManager', function () {
this.LockManager = SandboxedModule.require(modulePath, {
requires: {
'settings-sharelatex': {},
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
error: sinon.stub(),
err() {}
}),
fs: {
lstat: sinon.stub().callsArgWith(1),
readdir: sinon.stub().callsArgWith(1)

View file

@ -12,7 +12,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
const modulePath = require('path').join(
__dirname,
'../../../app/js/OutputFileFinder'
@ -26,8 +25,7 @@ describe('OutputFileFinder', function () {
this.OutputFileFinder = SandboxedModule.require(modulePath, {
requires: {
fs: (this.fs = {}),
child_process: { spawn: (this.spawn = sinon.stub()) },
'logger-sharelatex': { log: sinon.stub(), warn: sinon.stub() }
child_process: { spawn: (this.spawn = sinon.stub()) }
},
globals: {
Math // used by lodash

View file

@ -12,7 +12,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
const modulePath = require('path').join(
__dirname,
'../../../app/js/OutputFileOptimiser'
@ -28,7 +27,6 @@ describe('OutputFileOptimiser', function () {
fs: (this.fs = {}),
path: (this.Path = {}),
child_process: { spawn: (this.spawn = sinon.stub()) },
'logger-sharelatex': { log: sinon.stub(), warn: sinon.stub() },
'./Metrics': {}
},
globals: { Math } // used by lodash

View file

@ -13,7 +13,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
const assert = require('chai').assert
const modulePath = require('path').join(
__dirname,
@ -28,11 +27,6 @@ describe('ProjectPersistenceManager', function () {
'./UrlCache': (this.UrlCache = {}),
'./CompileManager': (this.CompileManager = {}),
diskusage: (this.diskusage = { check: sinon.stub() }),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
warn: sinon.stub(),
err: sinon.stub()
}),
'settings-sharelatex': (this.settings = {
project_cache_length_ms: 1000
}),

View file

@ -11,7 +11,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
const { expect } = require('chai')
const modulePath = require('path').join(
__dirname,

View file

@ -12,7 +12,6 @@
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
const { expect } = require('chai')
const should = require('chai').should()
const modulePath = require('path').join(
__dirname,
'../../../app/js/ResourceStateManager'
@ -26,7 +25,6 @@ describe('ResourceStateManager', function () {
singleOnly: true,
requires: {
fs: (this.fs = {}),
'logger-sharelatex': { log: sinon.stub(), err: sinon.stub() },
'./SafeReader': (this.SafeReader = {})
}
})

View file

@ -13,7 +13,6 @@
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
const { expect } = require('chai')
const should = require('chai').should()
const modulePath = require('path').join(
__dirname,
'../../../app/js/ResourceWriter'
@ -34,7 +33,6 @@ describe('ResourceWriter', function () {
wrench: (this.wrench = {}),
'./UrlCache': (this.UrlCache = {}),
'./OutputFileFinder': (this.OutputFileFinder = {}),
'logger-sharelatex': { log: sinon.stub(), err: sinon.stub() },
'./Metrics': (this.Metrics = {
inc: sinon.stub(),
Timer: (Timer = (function () {
@ -407,7 +405,7 @@ describe('ResourceWriter', function () {
})
return it('should not return an error if the resource writer errored', function () {
return should.not.exist(this.callback.args[0][0])
return expect(this.callback.args[0][0]).not.to.exist
})
})

View file

@ -9,7 +9,6 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const should = require('chai').should()
const SandboxedModule = require('sandboxed-module')
const assert = require('assert')
const path = require('path')
@ -32,11 +31,6 @@ describe('StaticServerForbidSymlinks', function () {
this.ForbidSymlinks = SandboxedModule.require(modulePath, {
requires: {
'settings-sharelatex': this.settings,
'logger-sharelatex': {
log() {},
warn() {},
error() {}
},
fs: this.fs
}
})

View file

@ -10,7 +10,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
const modulePath = require('path').join(
__dirname,
'../../../app/js/TikzManager'
@ -22,8 +21,7 @@ describe('TikzManager', function () {
requires: {
'./ResourceWriter': (this.ResourceWriter = {}),
'./SafeReader': (this.SafeReader = {}),
fs: (this.fs = {}),
'logger-sharelatex': (this.logger = { log() {} })
fs: (this.fs = {})
}
}))
})

View file

@ -12,7 +12,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
const modulePath = require('path').join(__dirname, '../../../app/js/UrlCache')
const { EventEmitter } = require('events')
@ -25,7 +24,6 @@ describe('UrlCache', function () {
requires: {
'./db': {},
'./UrlFetcher': (this.UrlFetcher = {}),
'logger-sharelatex': (this.logger = { log: sinon.stub() }),
'settings-sharelatex': (this.Settings = {
path: { clsiCacheDir: '/cache/dir' }
}),

View file

@ -11,7 +11,6 @@
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
const { expect } = require('chai')
require('chai').should()
const modulePath = require('path').join(__dirname, '../../../app/js/UrlFetcher')
const { EventEmitter } = require('events')
@ -25,10 +24,6 @@ describe('UrlFetcher', function () {
defaults: (this.defaults = sinon.stub().returns((this.request = {})))
},
fs: (this.fs = {}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
error: sinon.stub()
}),
'settings-sharelatex': (this.settings = {})
}
}))