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

Upgrade to Node 12
This commit is contained in:
Eric Mc Sween 2021-03-22 08:51:49 -04:00 committed by GitHub
commit 738cabb8f8
9 changed files with 39 additions and 25 deletions

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 # Instead run bin/update_build_scripts from
# https://github.com/sharelatex/sharelatex-dev-environment # https://github.com/sharelatex/sharelatex-dev-environment
FROM node:10.23.1 as base FROM node:12.21.0 as base
WORKDIR /app WORKDIR /app

View file

@ -21,8 +21,10 @@ DOCKER_COMPOSE_TEST_UNIT = \
COMPOSE_PROJECT_NAME=test_unit_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) COMPOSE_PROJECT_NAME=test_unit_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE)
clean: clean:
docker rmi ci/$(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 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: format:
$(DOCKER_COMPOSE) run --rm test_unit npm run --silent format $(DOCKER_COMPOSE) run --rm test_unit npm run --silent format

View file

@ -3,6 +3,6 @@ notifications
--docker-repos=gcr.io/overleaf-ops --docker-repos=gcr.io/overleaf-ops
--env-add= --env-add=
--env-pass-through= --env-pass-through=
--node-version=10.23.1 --node-version=12.21.0
--public-repo=True --public-repo=True
--script-version=3.4.0 --script-version=3.7.0

View file

@ -6,7 +6,7 @@ version: "2.3"
services: services:
test_unit: test_unit:
image: node:10.23.1 image: node:12.21.0
volumes: volumes:
- .:/app - .:/app
working_dir: /app working_dir: /app
@ -18,7 +18,7 @@ services:
user: node user: node
test_acceptance: test_acceptance:
image: node:10.23.1 image: node:12.21.0
volumes: volumes:
- .:/app - .:/app
working_dir: /app working_dir: /app

View file

@ -0,0 +1,21 @@
const chai = require('chai')
const SandboxedModule = require('sandboxed-module')
// Chai configuration
chai.should()
// SandboxedModule configuration
SandboxedModule.configure({
requires: {
'logger-sharelatex': {
debug() {},
log() {},
info() {},
warn() {},
err() {},
error() {},
fatal() {}
}
},
globals: { Buffer, JSON, console, process }
})

View file

@ -11,8 +11,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
const sinon = require('sinon') const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const modulePath = '../../../app/js/NotificationsController.js' const modulePath = '../../../app/js/NotificationsController.js'
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const assert = require('assert') const assert = require('assert')
@ -27,7 +25,6 @@ describe('Notifications Controller', function () {
this.notifications = {} this.notifications = {}
this.controller = SandboxedModule.require(modulePath, { this.controller = SandboxedModule.require(modulePath, {
requires: { requires: {
'logger-sharelatex': { log() {} },
'./Notifications': this.notifications, './Notifications': this.notifications,
'@overleaf/metrics': { '@overleaf/metrics': {
inc: sinon.stub() inc: sinon.stub()

View file

@ -13,9 +13,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
const sinon = require('sinon') const sinon = require('sinon')
const chai = require('chai') const { expect } = require('chai')
const expect = chai.should
const should = chai.should()
const modulePath = '../../../app/js/Notifications.js' const modulePath = '../../../app/js/Notifications.js'
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const assert = require('assert') const assert = require('assert')
@ -43,16 +41,9 @@ describe('Notifications Tests', function () {
this.notifications = SandboxedModule.require(modulePath, { this.notifications = SandboxedModule.require(modulePath, {
requires: { requires: {
'logger-sharelatex': {
log() {},
error() {}
},
'settings-sharelatex': {}, 'settings-sharelatex': {},
'./mongodb': { db: this.db, ObjectId }, './mongodb': { db: this.db, ObjectId },
'@overleaf/metrics': { timeAsyncMethod: sinon.stub() } '@overleaf/metrics': { timeAsyncMethod: sinon.stub() }
},
globals: {
console
} }
}) })
@ -109,7 +100,7 @@ describe('Notifications Tests', function () {
user_id, user_id,
this.stubbedNotification, this.stubbedNotification,
(err) => { (err) => {
expect(err).not.exists expect(err).not.to.exist
sinon.assert.calledWith( sinon.assert.calledWith(
this.updateOneStub, this.updateOneStub,
this.expectedQuery, this.expectedQuery,
@ -131,7 +122,7 @@ describe('Notifications Tests', function () {
user_id, user_id,
this.stubbedNotification, this.stubbedNotification,
(err) => { (err) => {
expect(err).not.exists expect(err).not.to.exist
sinon.assert.notCalled(this.updateOneStub) sinon.assert.notCalled(this.updateOneStub)
return done() return done()
} }
@ -144,7 +135,7 @@ describe('Notifications Tests', function () {
user_id, user_id,
this.stubbedNotification, this.stubbedNotification,
(err) => { (err) => {
expect(err).not.exists expect(err).not.to.exist
sinon.assert.calledWith( sinon.assert.calledWith(
this.updateOneStub, this.updateOneStub,
this.expectedQuery, this.expectedQuery,
@ -184,7 +175,7 @@ describe('Notifications Tests', function () {
user_id, user_id,
this.stubbedNotification, this.stubbedNotification,
(err) => { (err) => {
expect(err).not.exists expect(err).not.to.exist
sinon.assert.calledWith( sinon.assert.calledWith(
this.updateOneStub, this.updateOneStub,
this.expectedQuery, this.expectedQuery,