From 238e2b2565ee318eec19da7056b1d8bdf260e190 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Mon, 15 Jul 2019 11:33:47 +0100 Subject: [PATCH] Merge pull request #1937 from overleaf/spd-sandboxedmodule-global-console Add 'console' to SandboxedModule globals GitOrigin-RevId: fad442ca128561a4fa193b929f217cf31ad0f043 --- .../src/Analytics/AnalyticsControllerTests.js | 3 +++ .../unit/src/Analytics/AnalyticsManagerTests.js | 3 +++ .../src/Announcement/AnnouncementsHandlerTests.js | 3 +++ .../AuthenticationControllerTests.js | 3 +++ .../Authentication/AuthenticationManagerTests.js | 3 +++ .../Authorization/AuthorizationManagerTests.js | 3 +++ .../Authorization/AuthorizationMiddlewareTests.js | 3 +++ .../src/BetaProgram/BetaProgramControllerTests.js | 3 +++ .../src/BetaProgram/BetaProgramHandlerTests.js | 3 +++ .../web/test/unit/src/Blog/BlogControllerTests.js | 3 +++ .../BrandVariationsHandlerTests.js | 3 +++ .../web/test/unit/src/Chat/ChatApiHandlerTests.js | 3 +++ .../web/test/unit/src/Chat/ChatControllerTests.js | 3 +++ .../Collaborators/CollaboratorsControllerTests.js | 3 +++ .../Collaborators/CollaboratorsHandlerTests.js | 3 +++ .../CollaboratorsInviteControllerTests.js | 3 +++ .../CollaboratorsInviteHandlerTests.js | 3 +++ .../unit/src/Compile/ClsiCookieManagerTests.js | 12 ++++++++++++ .../unit/src/Compile/ClsiFormatCheckerTests.js | 3 +++ .../web/test/unit/src/Compile/ClsiManagerTests.js | 3 +++ .../unit/src/Compile/ClsiStateManagerTests.js | 3 +++ .../unit/src/Compile/CompileControllerTests.js | 3 +++ .../test/unit/src/Compile/CompileManagerTests.js | 3 +++ .../unit/src/Contact/ContactControllerTests.js | 3 +++ .../test/unit/src/Contact/ContactManagerTests.js | 3 +++ .../unit/src/Cooldown/CooldownManagerTests.js | 3 +++ .../unit/src/Cooldown/CooldownMiddlewareTests.js | 3 +++ .../unit/src/Docstore/DocstoreManagerTests.js | 3 +++ .../DocumentUpdaterHandlerTests.js | 3 +++ .../unit/src/Documents/DocumentControllerTests.js | 3 +++ .../Downloads/ProjectDownloadsControllerTests.js | 3 +++ .../src/Downloads/ProjectZipStreamManagerTests.js | 3 +++ .../test/unit/src/Editor/EditorControllerTests.js | 3 +++ .../unit/src/Editor/EditorHttpControllerTests.js | 3 +++ .../src/Editor/EditorRealTimeControllerTests.js | 3 +++ .../web/test/unit/src/Email/EmailBuilderTests.js | 3 +++ .../web/test/unit/src/Email/EmailHandlerTests.js | 3 +++ .../web/test/unit/src/Email/EmailSenderTests.js | 3 +++ .../unit/src/Exports/ExportsControllerTests.js | 3 +++ .../test/unit/src/Exports/ExportsHandlerTests.js | 3 +++ .../src/FileStore/FileStoreControllerTests.js | 3 +++ .../unit/src/FileStore/FileStoreHandlerTests.js | 3 +++ .../unit/src/History/HistoryControllerTests.js | 3 +++ .../test/unit/src/History/HistoryManagerTests.js | 3 +++ .../test/unit/src/History/RestoreManagerTests.js | 3 +++ .../InactiveData/InactiveProjectManagerTests.js | 3 +++ .../unit/src/Institutions/InstitutionsAPITests.js | 3 +++ .../Institutions/InstitutionsControllerTests.js | 3 +++ .../src/Institutions/InstitutionsFeaturesTests.js | 3 +++ .../src/Institutions/InstitutionsGetterTests.js | 3 +++ .../src/Institutions/InstitutionsManagerTests.js | 3 +++ .../test/unit/src/Metadata/MetaControllerTests.js | 3 +++ .../test/unit/src/Metadata/MetaHandlerTests.js | 3 +++ .../Notifications/NotificationsBuilderTests.js | 3 +++ .../Notifications/NotificationsControllerTests.js | 3 +++ .../Notifications/NotificationsHandlerTests.js | 3 +++ .../PasswordReset/PasswordResetControllerTests.js | 3 +++ .../PasswordReset/PasswordResetHandlerTests.js | 3 +++ .../unit/src/Project/DocLinesComparitorTests.js | 3 +++ .../unit/src/Project/ProjectApiControllerTests.js | 3 +++ .../src/Project/ProjectCollabratecDetailsTest.js | 3 +++ .../unit/src/Project/ProjectControllerTests.js | 3 +++ .../src/Project/ProjectCreationHandlerTests.js | 3 +++ .../test/unit/src/Project/ProjectDeleterTests.js | 3 +++ .../src/Project/ProjectDetailsHandlerTests.js | 3 +++ .../unit/src/Project/ProjectDuplicatorTests.js | 3 +++ .../unit/src/Project/ProjectEntityHandlerTests.js | 3 +++ .../ProjectEntityMongoUpdateHandlerTests.js | 3 +++ .../Project/ProjectEntityUpdateHandlerTests.js | 3 +++ .../test/unit/src/Project/ProjectGetterTests.js | 3 +++ .../src/Project/ProjectHistoryHandlerTests.js | 3 +++ .../test/unit/src/Project/ProjectLocatorTests.js | 3 +++ .../src/Project/ProjectOptionsHandlerTests.js | 3 +++ .../src/Project/ProjectRootDocManagerTests.js | 3 +++ .../unit/src/Project/ProjectUpdateHandlerTests.js | 3 +++ .../unit/src/Publishers/PublishersGetterTests.js | 3 +++ .../unit/src/Referal/ReferalAllocatorTests.js | 3 +++ .../test/unit/src/Referal/ReferalConnectTests.js | 3 +++ .../unit/src/Referal/ReferalControllerTests.js | 3 +++ .../test/unit/src/Referal/ReferalFeaturesTests.js | 3 +++ .../test/unit/src/Referal/ReferalHandlerTests.js | 3 +++ .../src/References/ReferencesControllerTests.js | 3 +++ .../unit/src/References/ReferencesHandlerTests.js | 3 +++ .../unit/src/Security/LoginRateLimiterTests.js | 3 +++ .../unit/src/Security/OneTimeTokenHandlerTests.js | 3 +++ .../src/Security/RateLimiterMiddlewareTests.js | 3 +++ .../unit/src/Subscription/FeaturesUpdaterTests.js | 3 +++ .../src/Subscription/LimitationsManagerTests.js | 3 +++ .../unit/src/Subscription/RecurlyWrapperTests.js | 3 +++ .../Subscription/SubscriptionControllerTests.js | 3 +++ .../SubscriptionGroupControllerTests.js | 3 +++ .../Subscription/SubscriptionGroupHandlerTests.js | 3 +++ .../src/Subscription/SubscriptionHandlerTests.js | 3 +++ .../src/Subscription/SubscriptionLocatorTests.js | 3 +++ .../src/Subscription/SubscriptionUpdaterTests.js | 3 +++ .../src/Subscription/TeamInvitesHandlerTests.js | 3 +++ .../src/Subscription/UserFeaturesUpdaterTests.js | 3 +++ .../Subscription/V1SusbcriptionManagerTests.js | 3 +++ .../unit/src/SudoMode/SudoModeControllerTests.js | 3 +++ .../unit/src/SudoMode/SudoModeHandlerTests.js | 3 +++ .../unit/src/SudoMode/SudoModeMiddlewareTests.js | 3 +++ .../SystemMessages/SystemMessageManagerTests.js | 3 +++ .../web/test/unit/src/Tags/TagsControllerTests.js | 3 +++ .../web/test/unit/src/Tags/TagsHandlerTests.js | 3 +++ .../src/Templates/TemplatesControllerTests.js | 3 +++ .../unit/src/Templates/TemplatesManagerTests.js | 3 +++ .../ThirdPartyDataStore/TpdsControllerTests.js | 3 +++ .../ThirdPartyDataStore/TpdsUpdateHandlerTests.js | 3 +++ .../ThirdPartyDataStore/TpdsUpdateSenderTests.js | 3 +++ .../src/ThirdPartyDataStore/UpdateMergerTests.js | 3 +++ .../src/TokenAccess/TokenAccessControllerTests.js | 3 +++ .../src/TokenAccess/TokenAccessHandlerTests.js | 3 +++ .../test/unit/src/Uploads/ArchiveManagerTests.js | 3 +++ .../src/Uploads/FileSystemImportManagerTests.js | 3 +++ .../test/unit/src/Uploads/FileTypeManagerTests.js | 3 +++ .../src/Uploads/ProjectUploadControllerTests.js | 3 +++ .../unit/src/Uploads/ProjectUploadManagerTests.js | 3 +++ .../web/test/unit/src/User/UserControllerTests.js | 3 +++ .../web/test/unit/src/User/UserCreatorTests.js | 3 +++ .../web/test/unit/src/User/UserDeleterTests.js | 3 +++ .../User/UserEmailsConfirmationHandlerTests.js | 3 +++ .../unit/src/User/UserEmailsControllerTests.js | 3 +++ .../web/test/unit/src/User/UserGetterTests.js | 3 +++ .../web/test/unit/src/User/UserHandlerTests.js | 3 +++ .../test/unit/src/User/UserInfoControllerTests.js | 3 +++ .../unit/src/User/UserPagesControllerTests.js | 3 +++ .../unit/src/User/UserRegistrationHandlerTests.js | 3 +++ .../unit/src/User/UserSessionsManagerTests.js | 3 +++ .../web/test/unit/src/User/UserUpdaterTests.js | 3 +++ .../UserMembershipAuthorizationTests.js | 3 +++ .../UserMembershipControllerTests.js | 3 +++ .../UserMembership/UserMembershipHandlerTests.js | 3 +++ .../UserMembershipViewModelTests.js | 3 +++ .../UserMembership/UserMembershipsHandlerTests.js | 3 +++ .../web/test/unit/src/infrastructure/CsrfTests.js | 15 +++++++++++++++ .../infrastructure/FaultTolerantRequestTests.js | 3 +++ .../unit/src/infrastructure/GeoIpLookupTests.js | 3 +++ .../infrastructure/LockManager/getLockTests.js | 3 +++ .../infrastructure/LockManager/tryLockTests.js | 3 +++ .../unit/src/infrastructure/ProxyManagerTests.js | 3 +++ .../unit/src/infrastructure/RateLimterTests.js | 9 +++++++++ .../unit/src/infrastructure/RedisWrapperTests.js | 3 +++ 142 files changed, 453 insertions(+) diff --git a/services/web/test/unit/src/Analytics/AnalyticsControllerTests.js b/services/web/test/unit/src/Analytics/AnalyticsControllerTests.js index 3d905b8900..982140a215 100644 --- a/services/web/test/unit/src/Analytics/AnalyticsControllerTests.js +++ b/services/web/test/unit/src/Analytics/AnalyticsControllerTests.js @@ -20,6 +20,9 @@ describe('AnalyticsController', function() { } this.controller = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './AnalyticsManager': this.AnalyticsManager, '../Authentication/AuthenticationController': this diff --git a/services/web/test/unit/src/Analytics/AnalyticsManagerTests.js b/services/web/test/unit/src/Analytics/AnalyticsManagerTests.js index 72d768856d..dffa907e48 100644 --- a/services/web/test/unit/src/Analytics/AnalyticsManagerTests.js +++ b/services/web/test/unit/src/Analytics/AnalyticsManagerTests.js @@ -18,6 +18,9 @@ describe('AnalyticsManager', function() { this.backgroundRequest = sinon.stub().yields() this.request = sinon.stub().yields() this.AnalyticsManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': this.settings, '../../infrastructure/FaultTolerantRequest': { diff --git a/services/web/test/unit/src/Announcement/AnnouncementsHandlerTests.js b/services/web/test/unit/src/Announcement/AnnouncementsHandlerTests.js index 4db144bd5a..e857e82c53 100644 --- a/services/web/test/unit/src/Announcement/AnnouncementsHandlerTests.js +++ b/services/web/test/unit/src/Announcement/AnnouncementsHandlerTests.js @@ -32,6 +32,9 @@ describe('AnnouncementsHandler', function() { this.BlogHandler = { getLatestAnnouncements: sinon.stub() } this.settings = {} return (this.handler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../Analytics/AnalyticsManager': this.AnalyticsManager, '../Blog/BlogHandler': this.BlogHandler, diff --git a/services/web/test/unit/src/Authentication/AuthenticationControllerTests.js b/services/web/test/unit/src/Authentication/AuthenticationControllerTests.js index 8808ba6567..d0d276faff 100644 --- a/services/web/test/unit/src/Authentication/AuthenticationControllerTests.js +++ b/services/web/test/unit/src/Authentication/AuthenticationControllerTests.js @@ -30,6 +30,9 @@ describe('AuthenticationController', function() { tk.freeze(Date.now()) this.UserModel = { findOne: sinon.stub() } this.AuthenticationController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './AuthenticationManager': (this.AuthenticationManager = {}), '../User/UserUpdater': (this.UserUpdater = { diff --git a/services/web/test/unit/src/Authentication/AuthenticationManagerTests.js b/services/web/test/unit/src/Authentication/AuthenticationManagerTests.js index d508152d36..238dd1d5f6 100644 --- a/services/web/test/unit/src/Authentication/AuthenticationManagerTests.js +++ b/services/web/test/unit/src/Authentication/AuthenticationManagerTests.js @@ -27,6 +27,9 @@ describe('AuthenticationManager', function() { beforeEach(function() { this.settings = { security: { bcryptRounds: 12 } } this.AuthenticationManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../models/User': { User: (this.User = {}) diff --git a/services/web/test/unit/src/Authorization/AuthorizationManagerTests.js b/services/web/test/unit/src/Authorization/AuthorizationManagerTests.js index 8d308c72a2..d1f7d412d6 100644 --- a/services/web/test/unit/src/Authorization/AuthorizationManagerTests.js +++ b/services/web/test/unit/src/Authorization/AuthorizationManagerTests.js @@ -23,6 +23,9 @@ const Errors = require('../../../../app/src/Features/Errors/Errors.js') describe('AuthorizationManager', function() { beforeEach(function() { this.AuthorizationManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../Collaborators/CollaboratorsHandler': (this.CollaboratorsHandler = {}), '../Project/ProjectGetter': (this.ProjectGetter = {}), diff --git a/services/web/test/unit/src/Authorization/AuthorizationMiddlewareTests.js b/services/web/test/unit/src/Authorization/AuthorizationMiddlewareTests.js index 5d300c3bf7..66bd736ff0 100644 --- a/services/web/test/unit/src/Authorization/AuthorizationMiddlewareTests.js +++ b/services/web/test/unit/src/Authorization/AuthorizationMiddlewareTests.js @@ -30,6 +30,9 @@ describe('AuthorizationMiddleware', function() { isUserLoggedIn: sinon.stub().returns(true) } this.AuthorizationMiddleware = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './AuthorizationManager': (this.AuthorizationManager = {}), 'logger-sharelatex': { log() {} }, diff --git a/services/web/test/unit/src/BetaProgram/BetaProgramControllerTests.js b/services/web/test/unit/src/BetaProgram/BetaProgramControllerTests.js index 47ab7ee521..f660cf3c15 100644 --- a/services/web/test/unit/src/BetaProgram/BetaProgramControllerTests.js +++ b/services/web/test/unit/src/BetaProgram/BetaProgramControllerTests.js @@ -37,6 +37,9 @@ describe('BetaProgramController', function() { } } this.BetaProgramController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './BetaProgramHandler': (this.BetaProgramHandler = { optIn: sinon.stub(), diff --git a/services/web/test/unit/src/BetaProgram/BetaProgramHandlerTests.js b/services/web/test/unit/src/BetaProgram/BetaProgramHandlerTests.js index ffaf9720c0..eb585dd53e 100644 --- a/services/web/test/unit/src/BetaProgram/BetaProgramHandlerTests.js +++ b/services/web/test/unit/src/BetaProgram/BetaProgramHandlerTests.js @@ -33,6 +33,9 @@ describe('BetaProgramHandler', function() { save: sinon.stub().callsArgWith(0, null) } return (this.handler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../models/User': { User: { diff --git a/services/web/test/unit/src/Blog/BlogControllerTests.js b/services/web/test/unit/src/Blog/BlogControllerTests.js index a84e60fe32..55280b6e18 100644 --- a/services/web/test/unit/src/Blog/BlogControllerTests.js +++ b/services/web/test/unit/src/Blog/BlogControllerTests.js @@ -33,6 +33,9 @@ describe('BlogController', function() { this.request = { get: sinon.stub() } this.ErrorController = {} this.BlogController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': this.settings, 'logger-sharelatex': { diff --git a/services/web/test/unit/src/BrandVariations/BrandVariationsHandlerTests.js b/services/web/test/unit/src/BrandVariations/BrandVariationsHandlerTests.js index 22e9f287a2..844d42435e 100644 --- a/services/web/test/unit/src/BrandVariations/BrandVariationsHandlerTests.js +++ b/services/web/test/unit/src/BrandVariations/BrandVariationsHandlerTests.js @@ -38,6 +38,9 @@ describe('BrandVariationsHandler', function() { } this.V1Api = { request: sinon.stub() } this.BrandVariationsHandler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': this.settings, 'logger-sharelatex': this.logger, diff --git a/services/web/test/unit/src/Chat/ChatApiHandlerTests.js b/services/web/test/unit/src/Chat/ChatApiHandlerTests.js index 316a264b4b..c5479dcd3f 100644 --- a/services/web/test/unit/src/Chat/ChatApiHandlerTests.js +++ b/services/web/test/unit/src/Chat/ChatApiHandlerTests.js @@ -32,6 +32,9 @@ describe('ChatApiHandler', function() { } this.request = sinon.stub() this.ChatApiHandler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': this.settings, 'logger-sharelatex': { diff --git a/services/web/test/unit/src/Chat/ChatControllerTests.js b/services/web/test/unit/src/Chat/ChatControllerTests.js index b72554fea5..eb6926212b 100644 --- a/services/web/test/unit/src/Chat/ChatControllerTests.js +++ b/services/web/test/unit/src/Chat/ChatControllerTests.js @@ -33,6 +33,9 @@ describe('ChatController', function() { getLoggedInUserId: sinon.stub().returns(this.user_id) } this.ChatController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': this.settings, 'logger-sharelatex': { diff --git a/services/web/test/unit/src/Collaborators/CollaboratorsControllerTests.js b/services/web/test/unit/src/Collaborators/CollaboratorsControllerTests.js index bc8b84cf9e..864200523e 100644 --- a/services/web/test/unit/src/Collaborators/CollaboratorsControllerTests.js +++ b/services/web/test/unit/src/Collaborators/CollaboratorsControllerTests.js @@ -25,6 +25,9 @@ const { ObjectId } = require('mongojs') describe('CollaboratorsController', function() { beforeEach(function() { this.CollaboratorsController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './CollaboratorsHandler': (this.CollaboratorsHandler = {}), '../Editor/EditorRealTimeController': (this.EditorRealTimeController = {}), diff --git a/services/web/test/unit/src/Collaborators/CollaboratorsHandlerTests.js b/services/web/test/unit/src/Collaborators/CollaboratorsHandlerTests.js index 38811126b5..125476a987 100644 --- a/services/web/test/unit/src/Collaborators/CollaboratorsHandlerTests.js +++ b/services/web/test/unit/src/Collaborators/CollaboratorsHandlerTests.js @@ -29,6 +29,9 @@ const { ObjectId } = require('mongojs') describe('CollaboratorsHandler', function() { beforeEach(function() { this.CollaboratorHandler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': (this.logger = { log: sinon.stub(), diff --git a/services/web/test/unit/src/Collaborators/CollaboratorsInviteControllerTests.js b/services/web/test/unit/src/Collaborators/CollaboratorsInviteControllerTests.js index 26438df3d0..bf892f6c33 100644 --- a/services/web/test/unit/src/Collaborators/CollaboratorsInviteControllerTests.js +++ b/services/web/test/unit/src/Collaborators/CollaboratorsInviteControllerTests.js @@ -44,6 +44,9 @@ describe('CollaboratorsInviteController', function() { } this.CollaboratorsInviteController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../Project/ProjectGetter': (this.ProjectGetter = {}), '../Subscription/LimitationsManager': this.LimitationsManager, diff --git a/services/web/test/unit/src/Collaborators/CollaboratorsInviteHandlerTests.js b/services/web/test/unit/src/Collaborators/CollaboratorsInviteHandlerTests.js index 2107313ad9..ce8bf2478d 100644 --- a/services/web/test/unit/src/Collaborators/CollaboratorsInviteHandlerTests.js +++ b/services/web/test/unit/src/Collaborators/CollaboratorsInviteHandlerTests.js @@ -54,6 +54,9 @@ describe('CollaboratorsInviteHandler', function() { })() this.Crypto = Crypto this.CollaboratorsInviteHandler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': (this.settings = {}), '../../models/ProjectInvite': { ProjectInvite: this.ProjectInvite }, diff --git a/services/web/test/unit/src/Compile/ClsiCookieManagerTests.js b/services/web/test/unit/src/Compile/ClsiCookieManagerTests.js index 420b7c6040..ec2c2550cb 100644 --- a/services/web/test/unit/src/Compile/ClsiCookieManagerTests.js +++ b/services/web/test/unit/src/Compile/ClsiCookieManagerTests.js @@ -70,6 +70,9 @@ describe('ClsiCookieManager', function() { }) } return (this.ClsiCookieManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: this.requires })()) }) @@ -196,6 +199,9 @@ describe('ClsiCookieManager', function() { it('should not set the server id if clsiCookies are not enabled', function(done) { delete this.settings.clsiCookie.key this.ClsiCookieManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: this.requires })() return this.ClsiCookieManager.setServerId( @@ -236,6 +242,9 @@ describe('ClsiCookieManager', function() { .withArgs('clsi_cookie_secondary') .returns(this.redis_secondary) this.ClsiCookieManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: this.requires })() this.ClsiCookieManager._parseServerIdFromResponse = sinon @@ -285,6 +294,9 @@ describe('ClsiCookieManager', function() { it('should return empty cookie jar if clsiCookies are not enabled', function(done) { delete this.settings.clsiCookie.key this.ClsiCookieManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: this.requires })() return this.ClsiCookieManager.getCookieJar(this.project_id, function( diff --git a/services/web/test/unit/src/Compile/ClsiFormatCheckerTests.js b/services/web/test/unit/src/Compile/ClsiFormatCheckerTests.js index ef953641f7..13da41df78 100644 --- a/services/web/test/unit/src/Compile/ClsiFormatCheckerTests.js +++ b/services/web/test/unit/src/Compile/ClsiFormatCheckerTests.js @@ -21,6 +21,9 @@ const SandboxedModule = require('sandboxed-module') describe('ClsiFormatChecker', function() { beforeEach(function() { this.ClsiFormatChecker = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': (this.settings = { compileBodySizeLimitMb: 5 }), 'logger-sharelatex': (this.logger = { diff --git a/services/web/test/unit/src/Compile/ClsiManagerTests.js b/services/web/test/unit/src/Compile/ClsiManagerTests.js index 575d49ba47..f85ab2696a 100644 --- a/services/web/test/unit/src/Compile/ClsiManagerTests.js +++ b/services/web/test/unit/src/Compile/ClsiManagerTests.js @@ -35,6 +35,9 @@ describe('ClsiManager', function() { checkRecoursesForProblems: sinon.stub().callsArgWith(1) } this.ClsiManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': (this.settings = { apis: { diff --git a/services/web/test/unit/src/Compile/ClsiStateManagerTests.js b/services/web/test/unit/src/Compile/ClsiStateManagerTests.js index 6409a12d33..f90364fda9 100644 --- a/services/web/test/unit/src/Compile/ClsiStateManagerTests.js +++ b/services/web/test/unit/src/Compile/ClsiStateManagerTests.js @@ -22,6 +22,9 @@ const SandboxedModule = require('sandboxed-module') describe('ClsiStateManager', function() { beforeEach(function() { this.ClsiStateManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': (this.settings = {}), '../Project/ProjectEntityHandler': (this.ProjectEntityHandler = {}), diff --git a/services/web/test/unit/src/Compile/CompileControllerTests.js b/services/web/test/unit/src/Compile/CompileControllerTests.js index d63224fac5..cabc3ca844 100644 --- a/services/web/test/unit/src/Compile/CompileControllerTests.js +++ b/services/web/test/unit/src/Compile/CompileControllerTests.js @@ -61,6 +61,9 @@ describe('CompileController', function() { isUserLoggedIn: sinon.stub().returns(true) } this.CompileController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': this.settings, request: (this.request = sinon.stub()), diff --git a/services/web/test/unit/src/Compile/CompileManagerTests.js b/services/web/test/unit/src/Compile/CompileManagerTests.js index 43e90917b8..9af9f4ff54 100644 --- a/services/web/test/unit/src/Compile/CompileManagerTests.js +++ b/services/web/test/unit/src/Compile/CompileManagerTests.js @@ -27,6 +27,9 @@ describe('CompileManager', function() { const { rateLimitGetStub } = this this.ratelimiter = { addCount: sinon.stub() } this.CompileManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': (this.settings = { redis: { web: { host: 'localhost', port: 42 } } diff --git a/services/web/test/unit/src/Contact/ContactControllerTests.js b/services/web/test/unit/src/Contact/ContactControllerTests.js index 8a7165cc27..a80595933d 100644 --- a/services/web/test/unit/src/Contact/ContactControllerTests.js +++ b/services/web/test/unit/src/Contact/ContactControllerTests.js @@ -23,6 +23,9 @@ describe('ContactController', function() { beforeEach(function() { this.AuthenticationController = { getLoggedInUserId: sinon.stub() } this.ContactController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': (this.logger = { log: sinon.stub(), diff --git a/services/web/test/unit/src/Contact/ContactManagerTests.js b/services/web/test/unit/src/Contact/ContactManagerTests.js index 5ef67fdfc9..19b6c08454 100644 --- a/services/web/test/unit/src/Contact/ContactManagerTests.js +++ b/services/web/test/unit/src/Contact/ContactManagerTests.js @@ -18,6 +18,9 @@ const SandboxedModule = require('sandboxed-module') describe('ContactManager', function() { beforeEach(function() { this.ContactManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { request: (this.request = sinon.stub()), 'settings-sharelatex': (this.settings = { diff --git a/services/web/test/unit/src/Cooldown/CooldownManagerTests.js b/services/web/test/unit/src/Cooldown/CooldownManagerTests.js index a5c5dcad9c..35dd45e1e0 100644 --- a/services/web/test/unit/src/Cooldown/CooldownManagerTests.js +++ b/services/web/test/unit/src/Cooldown/CooldownManagerTests.js @@ -25,6 +25,9 @@ describe('CooldownManager', function() { this.rclient = { set: sinon.stub(), get: sinon.stub() } this.RedisWrapper = { client: () => this.rclient } return (this.CooldownManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../infrastructure/RedisWrapper': this.RedisWrapper, 'logger-sharelatex': { log: sinon.stub() } diff --git a/services/web/test/unit/src/Cooldown/CooldownMiddlewareTests.js b/services/web/test/unit/src/Cooldown/CooldownMiddlewareTests.js index 381c24e58e..d50319db8f 100644 --- a/services/web/test/unit/src/Cooldown/CooldownMiddlewareTests.js +++ b/services/web/test/unit/src/Cooldown/CooldownMiddlewareTests.js @@ -22,6 +22,9 @@ describe('CooldownMiddleware', function() { beforeEach(function() { this.CooldownManager = { isProjectOnCooldown: sinon.stub() } return (this.CooldownMiddleware = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './CooldownManager': this.CooldownManager, 'logger-sharelatex': { log: sinon.stub() } diff --git a/services/web/test/unit/src/Docstore/DocstoreManagerTests.js b/services/web/test/unit/src/Docstore/DocstoreManagerTests.js index a8716de2ac..7142891df1 100644 --- a/services/web/test/unit/src/Docstore/DocstoreManagerTests.js +++ b/services/web/test/unit/src/Docstore/DocstoreManagerTests.js @@ -20,6 +20,9 @@ describe('DocstoreManager', function() { beforeEach(function() { this.requestDefaults = sinon.stub().returns((this.request = sinon.stub())) this.DocstoreManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { request: { defaults: this.requestDefaults diff --git a/services/web/test/unit/src/DocumentUpdater/DocumentUpdaterHandlerTests.js b/services/web/test/unit/src/DocumentUpdater/DocumentUpdaterHandlerTests.js index 198159b67d..b6e0fb8f3c 100644 --- a/services/web/test/unit/src/DocumentUpdater/DocumentUpdaterHandlerTests.js +++ b/services/web/test/unit/src/DocumentUpdater/DocumentUpdaterHandlerTests.js @@ -49,6 +49,9 @@ describe('DocumentUpdaterHandler', function() { this.callback = sinon.stub() return (this.handler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { request: { defaults: () => { diff --git a/services/web/test/unit/src/Documents/DocumentControllerTests.js b/services/web/test/unit/src/Documents/DocumentControllerTests.js index cf51877ea3..4c8fd127a6 100644 --- a/services/web/test/unit/src/Documents/DocumentControllerTests.js +++ b/services/web/test/unit/src/Documents/DocumentControllerTests.js @@ -25,6 +25,9 @@ const Errors = require('../../../../app/src/Features/Errors/Errors') describe('DocumentController', function() { beforeEach(function() { this.DocumentController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': { log() {}, diff --git a/services/web/test/unit/src/Downloads/ProjectDownloadsControllerTests.js b/services/web/test/unit/src/Downloads/ProjectDownloadsControllerTests.js index a46a72c261..46b8ae7944 100644 --- a/services/web/test/unit/src/Downloads/ProjectDownloadsControllerTests.js +++ b/services/web/test/unit/src/Downloads/ProjectDownloadsControllerTests.js @@ -30,6 +30,9 @@ describe('ProjectDownloadsController', function() { return (this.ProjectDownloadsController = SandboxedModule.require( modulePath, { + globals: { + console: console + }, requires: { './ProjectZipStreamManager': (this.ProjectZipStreamManager = {}), '../Project/ProjectGetter': (this.ProjectGetter = {}), diff --git a/services/web/test/unit/src/Downloads/ProjectZipStreamManagerTests.js b/services/web/test/unit/src/Downloads/ProjectZipStreamManagerTests.js index f521003a09..2e4b168214 100644 --- a/services/web/test/unit/src/Downloads/ProjectZipStreamManagerTests.js +++ b/services/web/test/unit/src/Downloads/ProjectZipStreamManagerTests.js @@ -33,6 +33,9 @@ describe('ProjectZipStreamManager', function() { append: sinon.stub() } return (this.ProjectZipStreamManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { archiver: (this.archiver = sinon.stub().returns(this.archive)), 'logger-sharelatex': (this.logger = { diff --git a/services/web/test/unit/src/Editor/EditorControllerTests.js b/services/web/test/unit/src/Editor/EditorControllerTests.js index ffb172fbc6..257acc0c72 100644 --- a/services/web/test/unit/src/Editor/EditorControllerTests.js +++ b/services/web/test/unit/src/Editor/EditorControllerTests.js @@ -45,6 +45,9 @@ describe('EditorController', function() { this.callback = sinon.stub() return (this.EditorController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../Project/ProjectEntityUpdateHandler': (this.ProjectEntityUpdateHandler = {}), '../Project/ProjectOptionsHandler': (this.ProjectOptionsHandler = { diff --git a/services/web/test/unit/src/Editor/EditorHttpControllerTests.js b/services/web/test/unit/src/Editor/EditorHttpControllerTests.js index da465edb4f..475e0062d5 100644 --- a/services/web/test/unit/src/Editor/EditorHttpControllerTests.js +++ b/services/web/test/unit/src/Editor/EditorHttpControllerTests.js @@ -21,6 +21,9 @@ const Errors = require('../../../../app/src/Features/Errors/Errors') describe('EditorHttpController', function() { beforeEach(function() { this.EditorHttpController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../Project/ProjectEntityUpdateHandler': (this.ProjectEntityUpdateHandler = {}), '../Project/ProjectDeleter': (this.ProjectDeleter = {}), diff --git a/services/web/test/unit/src/Editor/EditorRealTimeControllerTests.js b/services/web/test/unit/src/Editor/EditorRealTimeControllerTests.js index 7beeaaf81e..315bdf801c 100644 --- a/services/web/test/unit/src/Editor/EditorRealTimeControllerTests.js +++ b/services/web/test/unit/src/Editor/EditorRealTimeControllerTests.js @@ -22,6 +22,9 @@ describe('EditorRealTimeController', function() { beforeEach(function() { this.rclient = { publish: sinon.stub() } this.EditorRealTimeController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../infrastructure/RedisWrapper': { client: () => this.rclient diff --git a/services/web/test/unit/src/Email/EmailBuilderTests.js b/services/web/test/unit/src/Email/EmailBuilderTests.js index b3172e684c..4376ae0f98 100644 --- a/services/web/test/unit/src/Email/EmailBuilderTests.js +++ b/services/web/test/unit/src/Email/EmailBuilderTests.js @@ -31,6 +31,9 @@ describe('EmailBuilder', function() { brandPrefix: '' } return (this.EmailBuilder = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': this.settings, 'logger-sharelatex': { diff --git a/services/web/test/unit/src/Email/EmailHandlerTests.js b/services/web/test/unit/src/Email/EmailHandlerTests.js index bc31e68911..f0ab9784e4 100644 --- a/services/web/test/unit/src/Email/EmailHandlerTests.js +++ b/services/web/test/unit/src/Email/EmailHandlerTests.js @@ -27,6 +27,9 @@ describe('EmailHandler', function() { this.EmailBuilder = { buildEmail: sinon.stub() } this.EmailSender = { sendEmail: sinon.stub() } this.EmailHandler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './EmailBuilder': this.EmailBuilder, './EmailSender': this.EmailSender, diff --git a/services/web/test/unit/src/Email/EmailSenderTests.js b/services/web/test/unit/src/Email/EmailSenderTests.js index dc8f2f6e08..290b408773 100644 --- a/services/web/test/unit/src/Email/EmailSenderTests.js +++ b/services/web/test/unit/src/Email/EmailSenderTests.js @@ -42,6 +42,9 @@ describe('EmailSender', function() { this.ses = { createTransport: () => this.sesClient } this.sender = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { nodemailer: this.ses, 'nodemailer-mandrill-transport': {}, diff --git a/services/web/test/unit/src/Exports/ExportsControllerTests.js b/services/web/test/unit/src/Exports/ExportsControllerTests.js index b04d3efe8f..8a1d670ad3 100644 --- a/services/web/test/unit/src/Exports/ExportsControllerTests.js +++ b/services/web/test/unit/src/Exports/ExportsControllerTests.js @@ -64,6 +64,9 @@ describe('ExportsController', function() { getLoggedInUserId: sinon.stub().returns(this.req.session.user._id) } return (this.controller = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './ExportsHandler': this.handler, 'logger-sharelatex': { diff --git a/services/web/test/unit/src/Exports/ExportsHandlerTests.js b/services/web/test/unit/src/Exports/ExportsHandlerTests.js index 62306d4020..04cdf2cbfb 100644 --- a/services/web/test/unit/src/Exports/ExportsHandlerTests.js +++ b/services/web/test/unit/src/Exports/ExportsHandlerTests.js @@ -27,6 +27,9 @@ describe('ExportsHandler', function() { } } this.ExportsHandler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': { log() {}, diff --git a/services/web/test/unit/src/FileStore/FileStoreControllerTests.js b/services/web/test/unit/src/FileStore/FileStoreControllerTests.js index b62b898604..21c06913fb 100644 --- a/services/web/test/unit/src/FileStore/FileStoreControllerTests.js +++ b/services/web/test/unit/src/FileStore/FileStoreControllerTests.js @@ -14,6 +14,9 @@ describe('FileStoreController', function() { this.ProjectLocator = { findElement: sinon.stub() } this.Errors = { NotFoundError: sinon.stub() } this.controller = SandboxedModule.require(MODULE_PATH, { + globals: { + console: console + }, requires: { 'settings-sharelatex': this.settings, 'logger-sharelatex': (this.logger = { diff --git a/services/web/test/unit/src/FileStore/FileStoreHandlerTests.js b/services/web/test/unit/src/FileStore/FileStoreHandlerTests.js index 3b16a1a97a..cb0a4efa4f 100644 --- a/services/web/test/unit/src/FileStore/FileStoreHandlerTests.js +++ b/services/web/test/unit/src/FileStore/FileStoreHandlerTests.js @@ -63,6 +63,9 @@ describe('FileStoreHandler', function() { computeHash: sinon.stub().callsArgWith(1, null, this.hashValue) } this.handler = SandboxedModule.require(MODULE_PATH, { + globals: { + console: console + }, requires: { 'settings-sharelatex': this.settings, request: this.request, diff --git a/services/web/test/unit/src/History/HistoryControllerTests.js b/services/web/test/unit/src/History/HistoryControllerTests.js index d1e18ca93b..76702b0df5 100644 --- a/services/web/test/unit/src/History/HistoryControllerTests.js +++ b/services/web/test/unit/src/History/HistoryControllerTests.js @@ -26,6 +26,9 @@ describe('HistoryController', function() { getLoggedInUserId: sinon.stub().returns(this.user_id) } this.HistoryController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { request: (this.request = sinon.stub()), 'settings-sharelatex': (this.settings = {}), diff --git a/services/web/test/unit/src/History/HistoryManagerTests.js b/services/web/test/unit/src/History/HistoryManagerTests.js index dc481eba64..3d01692144 100644 --- a/services/web/test/unit/src/History/HistoryManagerTests.js +++ b/services/web/test/unit/src/History/HistoryManagerTests.js @@ -24,6 +24,9 @@ describe('HistoryManager', function() { getLoggedInUserId: sinon.stub().returns(this.user_id) } this.HistoryManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { request: (this.request = sinon.stub()), 'settings-sharelatex': (this.settings = {}), diff --git a/services/web/test/unit/src/History/RestoreManagerTests.js b/services/web/test/unit/src/History/RestoreManagerTests.js index 36c56db8ad..7b39a53048 100644 --- a/services/web/test/unit/src/History/RestoreManagerTests.js +++ b/services/web/test/unit/src/History/RestoreManagerTests.js @@ -27,6 +27,9 @@ describe('RestoreManager', function() { beforeEach(function() { tk.freeze(Date.now()) // freeze the time for these tests this.RestoreManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../infrastructure/FileWriter': (this.FileWriter = {}), '../Uploads/FileSystemImportManager': (this.FileSystemImportManager = {}), diff --git a/services/web/test/unit/src/InactiveData/InactiveProjectManagerTests.js b/services/web/test/unit/src/InactiveData/InactiveProjectManagerTests.js index a71ac7bc9e..cfca8a6d14 100644 --- a/services/web/test/unit/src/InactiveData/InactiveProjectManagerTests.js +++ b/services/web/test/unit/src/InactiveData/InactiveProjectManagerTests.js @@ -36,6 +36,9 @@ describe('InactiveProjectManager', function() { this.ProjectGetter = { getProject: sinon.stub() } this.TrackChangesManager = { archiveProject: sinon.stub() } this.InactiveProjectManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': this.settings, 'logger-sharelatex': { diff --git a/services/web/test/unit/src/Institutions/InstitutionsAPITests.js b/services/web/test/unit/src/Institutions/InstitutionsAPITests.js index a4d6f55a8b..c402850bb8 100644 --- a/services/web/test/unit/src/Institutions/InstitutionsAPITests.js +++ b/services/web/test/unit/src/Institutions/InstitutionsAPITests.js @@ -31,6 +31,9 @@ describe('InstitutionsAPI', function() { read: (this.markAsReadIpMatcher = sinon.stub().callsArgWith(1, null)) } this.InstitutionsAPI = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': this.logger, 'metrics-sharelatex': { diff --git a/services/web/test/unit/src/Institutions/InstitutionsControllerTests.js b/services/web/test/unit/src/Institutions/InstitutionsControllerTests.js index 16cc92dfa7..a0cdbd04d6 100644 --- a/services/web/test/unit/src/Institutions/InstitutionsControllerTests.js +++ b/services/web/test/unit/src/Institutions/InstitutionsControllerTests.js @@ -51,6 +51,9 @@ describe('InstitutionsController', function() { this.addAffiliation = sinon.stub().callsArgWith(3, null) this.refreshFeatures = sinon.stub().yields(null) this.InstitutionsController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': this.logger, '../User/UserGetter': { diff --git a/services/web/test/unit/src/Institutions/InstitutionsFeaturesTests.js b/services/web/test/unit/src/Institutions/InstitutionsFeaturesTests.js index dbbf9fb24a..267e2caab6 100644 --- a/services/web/test/unit/src/Institutions/InstitutionsFeaturesTests.js +++ b/services/web/test/unit/src/Institutions/InstitutionsFeaturesTests.js @@ -26,6 +26,9 @@ describe('InstitutionsFeatures', function() { this.PlansLocator = { findLocalPlanInSettings: sinon.stub() } this.institutionPlanCode = 'institution_plan_code' this.InstitutionsFeatures = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './InstitutionsGetter': this.InstitutionsGetter, '../Subscription/PlansLocator': this.PlansLocator, diff --git a/services/web/test/unit/src/Institutions/InstitutionsGetterTests.js b/services/web/test/unit/src/Institutions/InstitutionsGetterTests.js index f2bd0a8227..9083d1576d 100644 --- a/services/web/test/unit/src/Institutions/InstitutionsGetterTests.js +++ b/services/web/test/unit/src/Institutions/InstitutionsGetterTests.js @@ -22,6 +22,9 @@ describe('InstitutionsGetter', function() { beforeEach(function() { this.UserGetter = { getUserFullEmails: sinon.stub() } this.InstitutionsGetter = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../User/UserGetter': this.UserGetter, '../UserMembership/UserMembershipsHandler': (this.UserMembershipsHandler = {}), diff --git a/services/web/test/unit/src/Institutions/InstitutionsManagerTests.js b/services/web/test/unit/src/Institutions/InstitutionsManagerTests.js index 9f1db35fed..678f8a77f1 100644 --- a/services/web/test/unit/src/Institutions/InstitutionsManagerTests.js +++ b/services/web/test/unit/src/Institutions/InstitutionsManagerTests.js @@ -64,6 +64,9 @@ describe('InstitutionsManager', function() { this.Mongo = { ObjectId: sinon.stub().returnsArg(0) } return (this.InstitutionsManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': this.logger, './InstitutionsAPI': { diff --git a/services/web/test/unit/src/Metadata/MetaControllerTests.js b/services/web/test/unit/src/Metadata/MetaControllerTests.js index 433b1abfba..20e1037e7a 100644 --- a/services/web/test/unit/src/Metadata/MetaControllerTests.js +++ b/services/web/test/unit/src/Metadata/MetaControllerTests.js @@ -27,6 +27,9 @@ describe('MetaController', function() { getMetaForDoc: sinon.stub() } return (this.MetadataController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': { log: sinon.stub(), diff --git a/services/web/test/unit/src/Metadata/MetaHandlerTests.js b/services/web/test/unit/src/Metadata/MetaHandlerTests.js index b0937bb7a9..f4e9116c51 100644 --- a/services/web/test/unit/src/Metadata/MetaHandlerTests.js +++ b/services/web/test/unit/src/Metadata/MetaHandlerTests.js @@ -54,6 +54,9 @@ describe('MetaHandler', function() { } return (this.MetaHandler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../Project/ProjectEntityHandler': this.ProjectEntityHandler, '../DocumentUpdater/DocumentUpdaterHandler': this diff --git a/services/web/test/unit/src/Notifications/NotificationsBuilderTests.js b/services/web/test/unit/src/Notifications/NotificationsBuilderTests.js index 6aa84affa4..918dad2fb9 100644 --- a/services/web/test/unit/src/Notifications/NotificationsBuilderTests.js +++ b/services/web/test/unit/src/Notifications/NotificationsBuilderTests.js @@ -34,6 +34,9 @@ describe('NotificationsBuilder', function() { .returns(this.stubResponse) .callsArgWith(1, null, response, this.body) return (this.controller = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './NotificationsHandler': this.handler, 'settings-sharelatex': this.settings, diff --git a/services/web/test/unit/src/Notifications/NotificationsControllerTests.js b/services/web/test/unit/src/Notifications/NotificationsControllerTests.js index 9038b21357..211f3d95e0 100644 --- a/services/web/test/unit/src/Notifications/NotificationsControllerTests.js +++ b/services/web/test/unit/src/Notifications/NotificationsControllerTests.js @@ -46,6 +46,9 @@ describe('NotificationsController', function() { getLoggedInUserId: sinon.stub().returns(this.req.session.user._id) } return (this.controller = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './NotificationsHandler': this.handler, underscore: (this.underscore = { diff --git a/services/web/test/unit/src/Notifications/NotificationsHandlerTests.js b/services/web/test/unit/src/Notifications/NotificationsHandlerTests.js index 771e60da41..d0eedc5286 100644 --- a/services/web/test/unit/src/Notifications/NotificationsHandlerTests.js +++ b/services/web/test/unit/src/Notifications/NotificationsHandlerTests.js @@ -30,6 +30,9 @@ describe('NotificationsHandler', function() { beforeEach(function() { this.request = sinon.stub().callsArgWith(1) return (this.handler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': { apis: { notifications: { url: notificationUrl } } diff --git a/services/web/test/unit/src/PasswordReset/PasswordResetControllerTests.js b/services/web/test/unit/src/PasswordReset/PasswordResetControllerTests.js index 7dd8515785..08c8fb3361 100644 --- a/services/web/test/unit/src/PasswordReset/PasswordResetControllerTests.js +++ b/services/web/test/unit/src/PasswordReset/PasswordResetControllerTests.js @@ -39,6 +39,9 @@ describe('PasswordResetController', function() { removeReconfirmFlag: sinon.stub().callsArgWith(1, null) } this.PasswordResetController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': this.settings, './PasswordResetHandler': this.PasswordResetHandler, diff --git a/services/web/test/unit/src/PasswordReset/PasswordResetHandlerTests.js b/services/web/test/unit/src/PasswordReset/PasswordResetHandlerTests.js index 90dbc8e3f7..a1d2a206ff 100644 --- a/services/web/test/unit/src/PasswordReset/PasswordResetHandlerTests.js +++ b/services/web/test/unit/src/PasswordReset/PasswordResetHandlerTests.js @@ -27,6 +27,9 @@ describe('PasswordResetHandler', function() { } this.V1Api = { request: sinon.stub() } this.PasswordResetHandler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../User/UserGetter': this.UserGetter, '../Security/OneTimeTokenHandler': this.OneTimeTokenHandler, diff --git a/services/web/test/unit/src/Project/DocLinesComparitorTests.js b/services/web/test/unit/src/Project/DocLinesComparitorTests.js index a652442a8a..054e737741 100644 --- a/services/web/test/unit/src/Project/DocLinesComparitorTests.js +++ b/services/web/test/unit/src/Project/DocLinesComparitorTests.js @@ -20,6 +20,9 @@ const SandboxedModule = require('sandboxed-module') describe('doc lines comparitor', function() { beforeEach(function() { return (this.comparitor = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': { log() {} } } diff --git a/services/web/test/unit/src/Project/ProjectApiControllerTests.js b/services/web/test/unit/src/Project/ProjectApiControllerTests.js index 1dc89b0ace..12d3c15842 100644 --- a/services/web/test/unit/src/Project/ProjectApiControllerTests.js +++ b/services/web/test/unit/src/Project/ProjectApiControllerTests.js @@ -20,6 +20,9 @@ describe('Project api controller', function() { beforeEach(function() { this.ProjectDetailsHandler = { getDetails: sinon.stub() } this.controller = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './ProjectDetailsHandler': this.ProjectDetailsHandler, 'logger-sharelatex': { diff --git a/services/web/test/unit/src/Project/ProjectCollabratecDetailsTest.js b/services/web/test/unit/src/Project/ProjectCollabratecDetailsTest.js index 59586a4ac2..9a8133d707 100644 --- a/services/web/test/unit/src/Project/ProjectCollabratecDetailsTest.js +++ b/services/web/test/unit/src/Project/ProjectCollabratecDetailsTest.js @@ -34,6 +34,9 @@ describe('ProjectCollabratecDetailsHandler', function() { this.ProjectCollabratecDetailsHandler = SandboxedModule.require( modulePath, { + globals: { + console: console + }, requires: { '../../models/Project': { Project: this.ProjectModel } } diff --git a/services/web/test/unit/src/Project/ProjectControllerTests.js b/services/web/test/unit/src/Project/ProjectControllerTests.js index 39e729b8ca..b91d9bb019 100644 --- a/services/web/test/unit/src/Project/ProjectControllerTests.js +++ b/services/web/test/unit/src/Project/ProjectControllerTests.js @@ -116,6 +116,9 @@ describe('ProjectController', function() { this.getUserAffiliations = sinon.stub().callsArgWith(1, null, []) this.ProjectController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': this.settings, 'logger-sharelatex': { diff --git a/services/web/test/unit/src/Project/ProjectCreationHandlerTests.js b/services/web/test/unit/src/Project/ProjectCreationHandlerTests.js index 60109362d8..5b21be94d4 100644 --- a/services/web/test/unit/src/Project/ProjectCreationHandlerTests.js +++ b/services/web/test/unit/src/Project/ProjectCreationHandlerTests.js @@ -89,6 +89,9 @@ describe('ProjectCreationHandler', function() { this.AnalyticsManager = { recordEvent: sinon.stub() } return (this.handler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../models/User': { User: this.User diff --git a/services/web/test/unit/src/Project/ProjectDeleterTests.js b/services/web/test/unit/src/Project/ProjectDeleterTests.js index c7d5f18fd5..5f1a47da6d 100644 --- a/services/web/test/unit/src/Project/ProjectDeleterTests.js +++ b/services/web/test/unit/src/Project/ProjectDeleterTests.js @@ -72,6 +72,9 @@ describe('ProjectDeleter', function() { .yields(null, ['member-id-1', 'member-id-2']) } return (this.deleter = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../Editor/EditorController': this.editorController, '../../models/Project': { Project: this.Project }, diff --git a/services/web/test/unit/src/Project/ProjectDetailsHandlerTests.js b/services/web/test/unit/src/Project/ProjectDetailsHandlerTests.js index 55912c480e..6157e3798e 100644 --- a/services/web/test/unit/src/Project/ProjectDetailsHandlerTests.js +++ b/services/web/test/unit/src/Project/ProjectDetailsHandlerTests.js @@ -52,6 +52,9 @@ describe('ProjectDetailsHandler', function() { removeUserFromProject: sinon.stub().callsArg(2) } return (this.handler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './ProjectGetter': this.ProjectGetter, '../../models/Project': { diff --git a/services/web/test/unit/src/Project/ProjectDuplicatorTests.js b/services/web/test/unit/src/Project/ProjectDuplicatorTests.js index 13f4ec52f2..268ebc35ad 100644 --- a/services/web/test/unit/src/Project/ProjectDuplicatorTests.js +++ b/services/web/test/unit/src/Project/ProjectDuplicatorTests.js @@ -148,6 +148,9 @@ describe('ProjectDuplicator', function() { this.ProjectDeleter = { deleteProject: sinon.stub().callsArgWith(1, null) } return (this.duplicator = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../models/Project': { Project: this.Project }, '../DocumentUpdater/DocumentUpdaterHandler': this diff --git a/services/web/test/unit/src/Project/ProjectEntityHandlerTests.js b/services/web/test/unit/src/Project/ProjectEntityHandlerTests.js index 612abcdf9c..1aa263169a 100644 --- a/services/web/test/unit/src/Project/ProjectEntityHandlerTests.js +++ b/services/web/test/unit/src/Project/ProjectEntityHandlerTests.js @@ -61,6 +61,9 @@ describe('ProjectEntityHandler', function() { this.callback = sinon.stub() return (this.ProjectEntityHandler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': (this.logger = { log: sinon.stub(), diff --git a/services/web/test/unit/src/Project/ProjectEntityMongoUpdateHandlerTests.js b/services/web/test/unit/src/Project/ProjectEntityMongoUpdateHandlerTests.js index cf116f0c98..52d0245549 100644 --- a/services/web/test/unit/src/Project/ProjectEntityMongoUpdateHandlerTests.js +++ b/services/web/test/unit/src/Project/ProjectEntityMongoUpdateHandlerTests.js @@ -48,6 +48,9 @@ describe('ProjectEntityMongoUpdateHandler', function() { tk.freeze(Date.now()) return (this.subject = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': (this.logger = { log: sinon.stub(), diff --git a/services/web/test/unit/src/Project/ProjectEntityUpdateHandlerTests.js b/services/web/test/unit/src/Project/ProjectEntityUpdateHandlerTests.js index 26aee5ae20..7cc516906a 100644 --- a/services/web/test/unit/src/Project/ProjectEntityUpdateHandlerTests.js +++ b/services/web/test/unit/src/Project/ProjectEntityUpdateHandlerTests.js @@ -85,6 +85,9 @@ describe('ProjectEntityUpdateHandler', function() { return (this.ProjectEntityUpdateHandler = SandboxedModule.require( modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': (this.logger = { log: sinon.stub(), diff --git a/services/web/test/unit/src/Project/ProjectGetterTests.js b/services/web/test/unit/src/Project/ProjectGetterTests.js index c971b464ba..f77a98833f 100644 --- a/services/web/test/unit/src/Project/ProjectGetterTests.js +++ b/services/web/test/unit/src/Project/ProjectGetterTests.js @@ -24,6 +24,9 @@ describe('ProjectGetter', function() { beforeEach(function() { this.callback = sinon.stub() return (this.ProjectGetter = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../infrastructure/mongojs': { db: (this.db = { diff --git a/services/web/test/unit/src/Project/ProjectHistoryHandlerTests.js b/services/web/test/unit/src/Project/ProjectHistoryHandlerTests.js index 1b7ff936d1..9aecaf4240 100644 --- a/services/web/test/unit/src/Project/ProjectHistoryHandlerTests.js +++ b/services/web/test/unit/src/Project/ProjectHistoryHandlerTests.js @@ -46,6 +46,9 @@ describe('ProjectHistoryHandler', function() { this.callback = sinon.stub() return (this.ProjectHistoryHandler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': (this.logger = { log: sinon.stub(), diff --git a/services/web/test/unit/src/Project/ProjectLocatorTests.js b/services/web/test/unit/src/Project/ProjectLocatorTests.js index 2b2d5d62a4..3397430c30 100644 --- a/services/web/test/unit/src/Project/ProjectLocatorTests.js +++ b/services/web/test/unit/src/Project/ProjectLocatorTests.js @@ -66,6 +66,9 @@ describe('ProjectLocator', function() { getProject: sinon.stub().callsArgWith(2, null, project) } return (this.locator = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../models/Project': { Project }, '../../models/User': { User: this.User }, diff --git a/services/web/test/unit/src/Project/ProjectOptionsHandlerTests.js b/services/web/test/unit/src/Project/ProjectOptionsHandlerTests.js index c6a28157cb..73fa1a6429 100644 --- a/services/web/test/unit/src/Project/ProjectOptionsHandlerTests.js +++ b/services/web/test/unit/src/Project/ProjectOptionsHandlerTests.js @@ -32,6 +32,9 @@ describe('ProjectOptionsHandler', function() { this.projectModel.update = sinon.spy() return (this.handler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../models/Project': { Project: this.projectModel }, 'settings-sharelatex': { diff --git a/services/web/test/unit/src/Project/ProjectRootDocManagerTests.js b/services/web/test/unit/src/Project/ProjectRootDocManagerTests.js index f205ac1345..7724fc66bb 100644 --- a/services/web/test/unit/src/Project/ProjectRootDocManagerTests.js +++ b/services/web/test/unit/src/Project/ProjectRootDocManagerTests.js @@ -41,6 +41,9 @@ describe('ProjectRootDocManager', function() { stat: sinon.stub().callsArgWith(1, null, { size: 100 }) } return (this.ProjectRootDocManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './ProjectEntityHandler': (this.ProjectEntityHandler = {}), './ProjectEntityUpdateHandler': (this.ProjectEntityUpdateHandler = {}), diff --git a/services/web/test/unit/src/Project/ProjectUpdateHandlerTests.js b/services/web/test/unit/src/Project/ProjectUpdateHandlerTests.js index 37290e9208..892dfee737 100644 --- a/services/web/test/unit/src/Project/ProjectUpdateHandlerTests.js +++ b/services/web/test/unit/src/Project/ProjectUpdateHandlerTests.js @@ -29,6 +29,9 @@ describe('ProjectUpdateHandler', function() { this.ProjectModel = Project = class Project {} this.ProjectModel.update = sinon.stub().callsArg(3) return (this.handler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../models/Project': { Project: this.ProjectModel }, 'logger-sharelatex': { log: sinon.stub() } diff --git a/services/web/test/unit/src/Publishers/PublishersGetterTests.js b/services/web/test/unit/src/Publishers/PublishersGetterTests.js index c83741fdf9..b008e17ad2 100644 --- a/services/web/test/unit/src/Publishers/PublishersGetterTests.js +++ b/services/web/test/unit/src/Publishers/PublishersGetterTests.js @@ -29,6 +29,9 @@ describe('PublishersGetter', function() { } this.PublishersGetter = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../User/UserGetter': this.UserGetter, '../UserMembership/UserMembershipsHandler': (this.UserMembershipsHandler = { diff --git a/services/web/test/unit/src/Referal/ReferalAllocatorTests.js b/services/web/test/unit/src/Referal/ReferalAllocatorTests.js index 552381efe8..f27d0ebcf3 100644 --- a/services/web/test/unit/src/Referal/ReferalAllocatorTests.js +++ b/services/web/test/unit/src/Referal/ReferalAllocatorTests.js @@ -22,6 +22,9 @@ const modulePath = require('path').join( describe('ReferalAllocator', function() { beforeEach(function() { this.ReferalAllocator = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../models/User': { User: (this.User = {}) diff --git a/services/web/test/unit/src/Referal/ReferalConnectTests.js b/services/web/test/unit/src/Referal/ReferalConnectTests.js index 62df253ed6..d05c0bcf60 100644 --- a/services/web/test/unit/src/Referal/ReferalConnectTests.js +++ b/services/web/test/unit/src/Referal/ReferalConnectTests.js @@ -22,6 +22,9 @@ const modulePath = require('path').join( describe('Referal connect middle wear', function() { beforeEach(function() { return (this.connect = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': { log() {}, diff --git a/services/web/test/unit/src/Referal/ReferalControllerTests.js b/services/web/test/unit/src/Referal/ReferalControllerTests.js index 185652ff73..c30a2a88bf 100644 --- a/services/web/test/unit/src/Referal/ReferalControllerTests.js +++ b/services/web/test/unit/src/Referal/ReferalControllerTests.js @@ -22,6 +22,9 @@ const modulePath = require('path').join( describe('Referal controller', () => beforeEach(function() { return (this.controller = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': { log() {}, diff --git a/services/web/test/unit/src/Referal/ReferalFeaturesTests.js b/services/web/test/unit/src/Referal/ReferalFeaturesTests.js index 95a28ca261..55bb6a6967 100644 --- a/services/web/test/unit/src/Referal/ReferalFeaturesTests.js +++ b/services/web/test/unit/src/Referal/ReferalFeaturesTests.js @@ -22,6 +22,9 @@ const modulePath = require('path').join( describe('ReferalFeatures', function() { beforeEach(function() { this.ReferalFeatures = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../models/User': { User: (this.User = {}) diff --git a/services/web/test/unit/src/Referal/ReferalHandlerTests.js b/services/web/test/unit/src/Referal/ReferalHandlerTests.js index eed7a7af8f..0a3b555d8a 100644 --- a/services/web/test/unit/src/Referal/ReferalHandlerTests.js +++ b/services/web/test/unit/src/Referal/ReferalHandlerTests.js @@ -24,6 +24,9 @@ describe('Referal handler', function() { beforeEach(function() { this.User = { findById: sinon.stub() } this.handler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': { log() {}, diff --git a/services/web/test/unit/src/References/ReferencesControllerTests.js b/services/web/test/unit/src/References/ReferencesControllerTests.js index 7f79e0f51b..ab525ca000 100644 --- a/services/web/test/unit/src/References/ReferencesControllerTests.js +++ b/services/web/test/unit/src/References/ReferencesControllerTests.js @@ -23,6 +23,9 @@ describe('ReferencesController', function() { beforeEach(function() { this.projectId = '2222' this.controller = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': { log() {}, diff --git a/services/web/test/unit/src/References/ReferencesHandlerTests.js b/services/web/test/unit/src/References/ReferencesHandlerTests.js index dbb42ae0af..b10482a969 100644 --- a/services/web/test/unit/src/References/ReferencesHandlerTests.js +++ b/services/web/test/unit/src/References/ReferencesHandlerTests.js @@ -48,6 +48,9 @@ describe('ReferencesHandler', function() { } this.docIds = ['aaa', 'ccc'] this.handler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': { log() {}, diff --git a/services/web/test/unit/src/Security/LoginRateLimiterTests.js b/services/web/test/unit/src/Security/LoginRateLimiterTests.js index 3b0affe3b8..ca0806b7b5 100644 --- a/services/web/test/unit/src/Security/LoginRateLimiterTests.js +++ b/services/web/test/unit/src/Security/LoginRateLimiterTests.js @@ -28,6 +28,9 @@ describe('LoginRateLimiter', function() { } return (this.LoginRateLimiter = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../infrastructure/RateLimiter': this.RateLimiter } diff --git a/services/web/test/unit/src/Security/OneTimeTokenHandlerTests.js b/services/web/test/unit/src/Security/OneTimeTokenHandlerTests.js index b8d95c20d4..9714078d37 100644 --- a/services/web/test/unit/src/Security/OneTimeTokenHandlerTests.js +++ b/services/web/test/unit/src/Security/OneTimeTokenHandlerTests.js @@ -29,6 +29,9 @@ describe('OneTimeTokenHandler', function() { this.stubbedToken = 'mock-token' this.callback = sinon.stub() return (this.OneTimeTokenHandler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': this.settings, 'logger-sharelatex': { diff --git a/services/web/test/unit/src/Security/RateLimiterMiddlewareTests.js b/services/web/test/unit/src/Security/RateLimiterMiddlewareTests.js index 9a7a06be73..fd0b99844f 100644 --- a/services/web/test/unit/src/Security/RateLimiterMiddlewareTests.js +++ b/services/web/test/unit/src/Security/RateLimiterMiddlewareTests.js @@ -33,6 +33,9 @@ describe('RateLimiterMiddleware', function() { } } this.RateLimiterMiddleware = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../infrastructure/RateLimiter': (this.RateLimiter = {}), 'logger-sharelatex': (this.logger = { warn: sinon.stub() }), diff --git a/services/web/test/unit/src/Subscription/FeaturesUpdaterTests.js b/services/web/test/unit/src/Subscription/FeaturesUpdaterTests.js index b6b6581ffb..29ad7c9148 100644 --- a/services/web/test/unit/src/Subscription/FeaturesUpdaterTests.js +++ b/services/web/test/unit/src/Subscription/FeaturesUpdaterTests.js @@ -23,6 +23,9 @@ describe('FeaturesUpdater', function() { this.user_id = ObjectId().toString() return (this.FeaturesUpdater = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './UserFeaturesUpdater': (this.UserFeaturesUpdater = {}), './SubscriptionLocator': (this.SubscriptionLocator = {}), diff --git a/services/web/test/unit/src/Subscription/LimitationsManagerTests.js b/services/web/test/unit/src/Subscription/LimitationsManagerTests.js index e2f4d6ff4f..c099f61d4d 100644 --- a/services/web/test/unit/src/Subscription/LimitationsManagerTests.js +++ b/services/web/test/unit/src/Subscription/LimitationsManagerTests.js @@ -50,6 +50,9 @@ describe('LimitationsManager', function() { } return (this.LimitationsManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../Project/ProjectGetter': this.ProjectGetter, '../User/UserGetter': this.UserGetter, diff --git a/services/web/test/unit/src/Subscription/RecurlyWrapperTests.js b/services/web/test/unit/src/Subscription/RecurlyWrapperTests.js index 3b3b3568ff..7618d9b727 100644 --- a/services/web/test/unit/src/Subscription/RecurlyWrapperTests.js +++ b/services/web/test/unit/src/Subscription/RecurlyWrapperTests.js @@ -144,6 +144,9 @@ describe('RecurlyWrapper', function() { return (this.RecurlyWrapper = RecurlyWrapper = SandboxedModule.require( modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': this.settings, 'logger-sharelatex': { diff --git a/services/web/test/unit/src/Subscription/SubscriptionControllerTests.js b/services/web/test/unit/src/Subscription/SubscriptionControllerTests.js index 21ff137bfd..a78e9fa3bf 100644 --- a/services/web/test/unit/src/Subscription/SubscriptionControllerTests.js +++ b/services/web/test/unit/src/Subscription/SubscriptionControllerTests.js @@ -91,6 +91,9 @@ describe('SubscriptionController', function() { this.GeoIpLookup = { getCurrencyCode: sinon.stub() } this.UserGetter = { getUser: sinon.stub().callsArgWith(2, null, this.user) } this.SubscriptionController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../Authentication/AuthenticationController': this .AuthenticationController, diff --git a/services/web/test/unit/src/Subscription/SubscriptionGroupControllerTests.js b/services/web/test/unit/src/Subscription/SubscriptionGroupControllerTests.js index 5595c730a6..2ec9926cae 100644 --- a/services/web/test/unit/src/Subscription/SubscriptionGroupControllerTests.js +++ b/services/web/test/unit/src/Subscription/SubscriptionGroupControllerTests.js @@ -59,6 +59,9 @@ describe('SubscriptionGroupController', function() { } return (this.Controller = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './SubscriptionGroupHandler': this.GroupHandler, 'logger-sharelatex': { diff --git a/services/web/test/unit/src/Subscription/SubscriptionGroupHandlerTests.js b/services/web/test/unit/src/Subscription/SubscriptionGroupHandlerTests.js index 9781f1dd5d..09dfac214a 100644 --- a/services/web/test/unit/src/Subscription/SubscriptionGroupHandlerTests.js +++ b/services/web/test/unit/src/Subscription/SubscriptionGroupHandlerTests.js @@ -86,6 +86,9 @@ describe('SubscriptionGroupHandler', function() { } return (this.Handler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': { log() {} diff --git a/services/web/test/unit/src/Subscription/SubscriptionHandlerTests.js b/services/web/test/unit/src/Subscription/SubscriptionHandlerTests.js index 1004a74da9..59c0ea360e 100644 --- a/services/web/test/unit/src/Subscription/SubscriptionHandlerTests.js +++ b/services/web/test/unit/src/Subscription/SubscriptionHandlerTests.js @@ -87,6 +87,9 @@ describe('SubscriptionHandler', function() { this.AnalyticsManager = { recordEvent: sinon.stub() } this.SubscriptionHandler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './RecurlyWrapper': this.RecurlyWrapper, 'settings-sharelatex': this.Settings, diff --git a/services/web/test/unit/src/Subscription/SubscriptionLocatorTests.js b/services/web/test/unit/src/Subscription/SubscriptionLocatorTests.js index f5665c1d48..eb4f2d2d19 100644 --- a/services/web/test/unit/src/Subscription/SubscriptionLocatorTests.js +++ b/services/web/test/unit/src/Subscription/SubscriptionLocatorTests.js @@ -28,6 +28,9 @@ describe('Subscription Locator Tests', function() { find: sinon.stub() } return (this.SubscriptionLocator = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../models/Subscription': { Subscription: this.Subscription diff --git a/services/web/test/unit/src/Subscription/SubscriptionUpdaterTests.js b/services/web/test/unit/src/Subscription/SubscriptionUpdaterTests.js index 652a57b2c0..02b614e597 100644 --- a/services/web/test/unit/src/Subscription/SubscriptionUpdaterTests.js +++ b/services/web/test/unit/src/Subscription/SubscriptionUpdaterTests.js @@ -95,6 +95,9 @@ describe('SubscriptionUpdater', function() { refreshFeatures: sinon.stub().yields() } this.SubscriptionUpdater = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../models/Subscription': { Subscription: this.SubscriptionModel diff --git a/services/web/test/unit/src/Subscription/TeamInvitesHandlerTests.js b/services/web/test/unit/src/Subscription/TeamInvitesHandlerTests.js index fbae4303f1..b78cfedca2 100644 --- a/services/web/test/unit/src/Subscription/TeamInvitesHandlerTests.js +++ b/services/web/test/unit/src/Subscription/TeamInvitesHandlerTests.js @@ -83,6 +83,9 @@ describe('TeamInvitesHandler', function() { this.Subscription.findOne.yields(null, this.subscription) this.TeamInvitesHandler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': { log() {} }, crypto: this.crypto, diff --git a/services/web/test/unit/src/Subscription/UserFeaturesUpdaterTests.js b/services/web/test/unit/src/Subscription/UserFeaturesUpdaterTests.js index dd1dd645cb..3e9259eda1 100644 --- a/services/web/test/unit/src/Subscription/UserFeaturesUpdaterTests.js +++ b/services/web/test/unit/src/Subscription/UserFeaturesUpdaterTests.js @@ -23,6 +23,9 @@ describe('UserFeaturesUpdater', function() { beforeEach(function() { this.User = { update: sinon.stub().callsArgWith(2) } return (this.UserFeaturesUpdater = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../models/User': { User: this.User diff --git a/services/web/test/unit/src/Subscription/V1SusbcriptionManagerTests.js b/services/web/test/unit/src/Subscription/V1SusbcriptionManagerTests.js index c0622b3ed8..0888a0d6cf 100644 --- a/services/web/test/unit/src/Subscription/V1SusbcriptionManagerTests.js +++ b/services/web/test/unit/src/Subscription/V1SusbcriptionManagerTests.js @@ -26,6 +26,9 @@ const { expect } = require('chai') describe('V1SubscriptionManager', function() { beforeEach(function() { this.V1SubscriptionManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../User/UserGetter': (this.UserGetter = {}), 'logger-sharelatex': { diff --git a/services/web/test/unit/src/SudoMode/SudoModeControllerTests.js b/services/web/test/unit/src/SudoMode/SudoModeControllerTests.js index 8f3546a252..897da7bd3c 100644 --- a/services/web/test/unit/src/SudoMode/SudoModeControllerTests.js +++ b/services/web/test/unit/src/SudoMode/SudoModeControllerTests.js @@ -36,6 +36,9 @@ describe('SudoModeController', function() { } this.UserGetter = { getUser: sinon.stub() } return (this.SudoModeController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': { log: sinon.stub(), diff --git a/services/web/test/unit/src/SudoMode/SudoModeHandlerTests.js b/services/web/test/unit/src/SudoMode/SudoModeHandlerTests.js index c90c2e3bdc..7cb590dec5 100644 --- a/services/web/test/unit/src/SudoMode/SudoModeHandlerTests.js +++ b/services/web/test/unit/src/SudoMode/SudoModeHandlerTests.js @@ -32,6 +32,9 @@ describe('SudoModeHandler', function() { this.rclient = { get: sinon.stub(), set: sinon.stub(), del: sinon.stub() } this.RedisWrapper = { client: () => this.rclient } return (this.SudoModeHandler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../infrastructure/RedisWrapper': this.RedisWrapper, 'logger-sharelatex': (this.logger = { diff --git a/services/web/test/unit/src/SudoMode/SudoModeMiddlewareTests.js b/services/web/test/unit/src/SudoMode/SudoModeMiddlewareTests.js index 290b6995b1..14ebdf8b97 100644 --- a/services/web/test/unit/src/SudoMode/SudoModeMiddlewareTests.js +++ b/services/web/test/unit/src/SudoMode/SudoModeMiddlewareTests.js @@ -29,6 +29,9 @@ describe('SudoModeMiddleware', function() { setRedirectInSession: sinon.stub() } return (this.SudoModeMiddleware = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './SudoModeHandler': this.SudoModeHandler, '../Authentication/AuthenticationController': this diff --git a/services/web/test/unit/src/SystemMessages/SystemMessageManagerTests.js b/services/web/test/unit/src/SystemMessages/SystemMessageManagerTests.js index 3cc79935f9..31eb67124e 100644 --- a/services/web/test/unit/src/SystemMessages/SystemMessageManagerTests.js +++ b/services/web/test/unit/src/SystemMessages/SystemMessageManagerTests.js @@ -23,6 +23,9 @@ describe('SystemMessageManager', function() { beforeEach(function() { this.SystemMessage = {} this.SystemMessageManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../models/SystemMessage': { SystemMessage: this.SystemMessage } } diff --git a/services/web/test/unit/src/Tags/TagsControllerTests.js b/services/web/test/unit/src/Tags/TagsControllerTests.js index 39f107f54e..ce9a86c3a1 100644 --- a/services/web/test/unit/src/Tags/TagsControllerTests.js +++ b/services/web/test/unit/src/Tags/TagsControllerTests.js @@ -39,6 +39,9 @@ describe('TagsController', function() { } } this.controller = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './TagsHandler': this.handler, 'logger-sharelatex': { diff --git a/services/web/test/unit/src/Tags/TagsHandlerTests.js b/services/web/test/unit/src/Tags/TagsHandlerTests.js index a0fb7eebde..9ce21ba380 100644 --- a/services/web/test/unit/src/Tags/TagsHandlerTests.js +++ b/services/web/test/unit/src/Tags/TagsHandlerTests.js @@ -36,6 +36,9 @@ describe('TagsHandler', function() { } this.callback = sinon.stub() return (this.handler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': { apis: { tags: { url: tagsUrl } } diff --git a/services/web/test/unit/src/Templates/TemplatesControllerTests.js b/services/web/test/unit/src/Templates/TemplatesControllerTests.js index e27c9d5c68..af6d20aef5 100644 --- a/services/web/test/unit/src/Templates/TemplatesControllerTests.js +++ b/services/web/test/unit/src/Templates/TemplatesControllerTests.js @@ -24,6 +24,9 @@ describe('TemplatesController', function() { beforeEach(function() { this.user_id = 'user-id' this.TemplatesController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../Authentication/AuthenticationController': (this.AuthenticationController = { getLoggedInUserId: sinon.stub().returns(this.user_id) diff --git a/services/web/test/unit/src/Templates/TemplatesManagerTests.js b/services/web/test/unit/src/Templates/TemplatesManagerTests.js index e557e9cc53..57053eaf47 100644 --- a/services/web/test/unit/src/Templates/TemplatesManagerTests.js +++ b/services/web/test/unit/src/Templates/TemplatesManagerTests.js @@ -65,6 +65,9 @@ describe('TemplatesManager', function() { this.Project = { update: sinon.stub().callsArgWith(3, null) } this.FileWriter = { ensureDumpFolderExists: sinon.stub().callsArg(0) } this.TemplatesManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../Uploads/ProjectUploadManager': this.ProjectUploadManager, '../Project/ProjectOptionsHandler': this.ProjectOptionsHandler, diff --git a/services/web/test/unit/src/ThirdPartyDataStore/TpdsControllerTests.js b/services/web/test/unit/src/ThirdPartyDataStore/TpdsControllerTests.js index 42422b47a0..6798fdf12e 100644 --- a/services/web/test/unit/src/ThirdPartyDataStore/TpdsControllerTests.js +++ b/services/web/test/unit/src/ThirdPartyDataStore/TpdsControllerTests.js @@ -22,6 +22,9 @@ describe('TpdsController', function() { beforeEach(function() { this.TpdsUpdateHandler = {} this.TpdsController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './TpdsUpdateHandler': this.TpdsUpdateHandler, './UpdateMerger': (this.UpdateMerger = {}), diff --git a/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateHandlerTests.js b/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateHandlerTests.js index 652dcf5caa..ae660e6497 100644 --- a/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateHandlerTests.js +++ b/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateHandlerTests.js @@ -51,6 +51,9 @@ describe('TpdsUpdateHandler', function() { isProjectOnCooldown: sinon.stub().callsArgWith(1, null, false) } this.handler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './UpdateMerger': this.updateMerger, './Editor/EditorController': this.editorController, diff --git a/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js b/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js index fa5e634b5a..cc9fc8a276 100644 --- a/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js +++ b/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js @@ -61,6 +61,9 @@ describe('TpdsUpdateSender', function() { } } return (this.updateSender = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': this.settings, 'logger-sharelatex': { log() {} }, diff --git a/services/web/test/unit/src/ThirdPartyDataStore/UpdateMergerTests.js b/services/web/test/unit/src/ThirdPartyDataStore/UpdateMergerTests.js index 407916a1cc..5a164931bf 100644 --- a/services/web/test/unit/src/ThirdPartyDataStore/UpdateMergerTests.js +++ b/services/web/test/unit/src/ThirdPartyDataStore/UpdateMergerTests.js @@ -23,6 +23,9 @@ const BufferedStream = require('bufferedstream') describe('UpdateMerger :', function() { beforeEach(function() { this.updateMerger = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { fs: (this.fs = { unlink: sinon.stub().callsArgWith(1) }), 'logger-sharelatex': { diff --git a/services/web/test/unit/src/TokenAccess/TokenAccessControllerTests.js b/services/web/test/unit/src/TokenAccess/TokenAccessControllerTests.js index 2df17a9db2..83d73525a1 100644 --- a/services/web/test/unit/src/TokenAccess/TokenAccessControllerTests.js +++ b/services/web/test/unit/src/TokenAccess/TokenAccessControllerTests.js @@ -42,6 +42,9 @@ describe('TokenAccessController', function() { } this.userId = ObjectId() this.TokenAccessController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../Project/ProjectController': (this.ProjectController = {}), '../Authentication/AuthenticationController': (this.AuthenticationController = {}), diff --git a/services/web/test/unit/src/TokenAccess/TokenAccessHandlerTests.js b/services/web/test/unit/src/TokenAccess/TokenAccessHandlerTests.js index 4be9b460ee..7cfec653ff 100644 --- a/services/web/test/unit/src/TokenAccess/TokenAccessHandlerTests.js +++ b/services/web/test/unit/src/TokenAccess/TokenAccessHandlerTests.js @@ -34,6 +34,9 @@ describe('TokenAccessHandler', function() { this.userId = ObjectId() this.req = {} return (this.TokenAccessHandler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../models/Project': { Project: (this.Project = {}) }, 'settings-sharelatex': (this.settings = {}), diff --git a/services/web/test/unit/src/Uploads/ArchiveManagerTests.js b/services/web/test/unit/src/Uploads/ArchiveManagerTests.js index ee830c0288..2e0f1b82b3 100644 --- a/services/web/test/unit/src/Uploads/ArchiveManagerTests.js +++ b/services/web/test/unit/src/Uploads/ArchiveManagerTests.js @@ -46,6 +46,9 @@ describe('ArchiveManager', function() { this.zipfile.close = sinon.stub() this.ArchiveManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { yauzl: (this.yauzl = { open: sinon.stub().callsArgWith(2, null, this.zipfile) diff --git a/services/web/test/unit/src/Uploads/FileSystemImportManagerTests.js b/services/web/test/unit/src/Uploads/FileSystemImportManagerTests.js index 20ab1458c2..f2e6aaad9e 100644 --- a/services/web/test/unit/src/Uploads/FileSystemImportManagerTests.js +++ b/services/web/test/unit/src/Uploads/FileSystemImportManagerTests.js @@ -32,6 +32,9 @@ describe('FileSystemImportManager', function() { convertTexEncodingsToUtf8: sinon.stub().returnsArg(0) } return (this.FileSystemImportManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { fs: (this.fs = {}), '../Editor/EditorController': (this.EditorController = {}), diff --git a/services/web/test/unit/src/Uploads/FileTypeManagerTests.js b/services/web/test/unit/src/Uploads/FileTypeManagerTests.js index 0ea22457c9..f94ff10c6f 100644 --- a/services/web/test/unit/src/Uploads/FileTypeManagerTests.js +++ b/services/web/test/unit/src/Uploads/FileTypeManagerTests.js @@ -26,6 +26,9 @@ describe('FileTypeManager', function() { this.ced = sinon.stub() this.DocumentHelper = { getEncodingFromTexContent: sinon.stub() } return (this.FileTypeManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { fs: this.fs, 'is-utf8': this.isUtf8 diff --git a/services/web/test/unit/src/Uploads/ProjectUploadControllerTests.js b/services/web/test/unit/src/Uploads/ProjectUploadControllerTests.js index 519730ff56..7be632bad7 100644 --- a/services/web/test/unit/src/Uploads/ProjectUploadControllerTests.js +++ b/services/web/test/unit/src/Uploads/ProjectUploadControllerTests.js @@ -44,6 +44,9 @@ describe('ProjectUploadController', function() { } return (this.ProjectUploadController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './ProjectUploadManager': (this.ProjectUploadManager = {}), './FileSystemImportManager': (this.FileSystemImportManager = {}), diff --git a/services/web/test/unit/src/Uploads/ProjectUploadManagerTests.js b/services/web/test/unit/src/Uploads/ProjectUploadManagerTests.js index 1b3b08b0e8..ce371d380e 100644 --- a/services/web/test/unit/src/Uploads/ProjectUploadManagerTests.js +++ b/services/web/test/unit/src/Uploads/ProjectUploadManagerTests.js @@ -36,6 +36,9 @@ describe('ProjectUploadManager', function() { rootFolder: [{ _id: this.root_folder_id }] } this.ProjectUploadManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './FileSystemImportManager': (this.FileSystemImportManager = {}), './ArchiveManager': (this.ArchiveManager = { promises: {} }), diff --git a/services/web/test/unit/src/User/UserControllerTests.js b/services/web/test/unit/src/User/UserControllerTests.js index 2d04e61ffb..ca0f49425b 100644 --- a/services/web/test/unit/src/User/UserControllerTests.js +++ b/services/web/test/unit/src/User/UserControllerTests.js @@ -73,6 +73,9 @@ describe('UserController', function() { } this.SudoModeHandler = { clearSudoMode: sinon.stub() } this.UserController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './UserGetter': this.UserGetter, './UserDeleter': this.UserDeleter, diff --git a/services/web/test/unit/src/User/UserCreatorTests.js b/services/web/test/unit/src/User/UserCreatorTests.js index 5e723b3d15..3f00ecad35 100644 --- a/services/web/test/unit/src/User/UserCreatorTests.js +++ b/services/web/test/unit/src/User/UserCreatorTests.js @@ -33,6 +33,9 @@ describe('UserCreator', function() { this.UserGetter = { getUserByMainEmail: sinon.stub() } this.addAffiliation = sinon.stub().yields() this.UserCreator = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../models/User': { User: this.UserModel diff --git a/services/web/test/unit/src/User/UserDeleterTests.js b/services/web/test/unit/src/User/UserDeleterTests.js index db8d50676a..ba71d366b8 100644 --- a/services/web/test/unit/src/User/UserDeleterTests.js +++ b/services/web/test/unit/src/User/UserDeleterTests.js @@ -62,6 +62,9 @@ describe('UserDeleter', function() { } return (this.UserDeleter = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../models/User': { User: this.User diff --git a/services/web/test/unit/src/User/UserEmailsConfirmationHandlerTests.js b/services/web/test/unit/src/User/UserEmailsConfirmationHandlerTests.js index d039a1e375..7a3f4ce4ec 100644 --- a/services/web/test/unit/src/User/UserEmailsConfirmationHandlerTests.js +++ b/services/web/test/unit/src/User/UserEmailsConfirmationHandlerTests.js @@ -26,6 +26,9 @@ const EmailHelper = require('../../../../app/src/Features/Helpers/EmailHelper') describe('UserEmailsConfirmationHandler', function() { beforeEach(function() { this.UserEmailsConfirmationHandler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': (this.settings = { siteUrl: 'emails.example.com' diff --git a/services/web/test/unit/src/User/UserEmailsControllerTests.js b/services/web/test/unit/src/User/UserEmailsControllerTests.js index da2a2ca6b3..37a8517e1c 100644 --- a/services/web/test/unit/src/User/UserEmailsControllerTests.js +++ b/services/web/test/unit/src/User/UserEmailsControllerTests.js @@ -40,6 +40,9 @@ describe('UserEmailsController', function() { this.EmailHelper = { parseEmail: sinon.stub() } this.endorseAffiliation = sinon.stub().yields() return (this.UserEmailsController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../Authentication/AuthenticationController': this .AuthenticationController, diff --git a/services/web/test/unit/src/User/UserGetterTests.js b/services/web/test/unit/src/User/UserGetterTests.js index c32acac2c8..8448d5a21e 100644 --- a/services/web/test/unit/src/User/UserGetterTests.js +++ b/services/web/test/unit/src/User/UserGetterTests.js @@ -48,6 +48,9 @@ describe('UserGetter', function() { this.getUserAffiliations = sinon.stub().callsArgWith(1, null, []) return (this.UserGetter = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': { log() {} diff --git a/services/web/test/unit/src/User/UserHandlerTests.js b/services/web/test/unit/src/User/UserHandlerTests.js index b769d6916e..a175b1fef0 100644 --- a/services/web/test/unit/src/User/UserHandlerTests.js +++ b/services/web/test/unit/src/User/UserHandlerTests.js @@ -29,6 +29,9 @@ describe('UserHandler', function() { } return (this.UserHandler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../Subscription/TeamInvitesHandler': this.TeamInvitesHandler } diff --git a/services/web/test/unit/src/User/UserInfoControllerTests.js b/services/web/test/unit/src/User/UserInfoControllerTests.js index bcf44ee451..ead443bcb9 100644 --- a/services/web/test/unit/src/User/UserInfoControllerTests.js +++ b/services/web/test/unit/src/User/UserInfoControllerTests.js @@ -35,6 +35,9 @@ describe('UserInfoController', function() { this.UserGetter = {} this.UserInfoController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './UserGetter': this.UserGetter, './UserUpdater': this.UserUpdater, diff --git a/services/web/test/unit/src/User/UserPagesControllerTests.js b/services/web/test/unit/src/User/UserPagesControllerTests.js index beae0e1279..e3f0e9043a 100644 --- a/services/web/test/unit/src/User/UserPagesControllerTests.js +++ b/services/web/test/unit/src/User/UserPagesControllerTests.js @@ -60,6 +60,9 @@ describe('UserPagesController', function() { setRedirectInSession: sinon.stub() } this.UserPagesController = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': this.settings, 'logger-sharelatex': { diff --git a/services/web/test/unit/src/User/UserRegistrationHandlerTests.js b/services/web/test/unit/src/User/UserRegistrationHandlerTests.js index 516c3e204f..946e3d4b06 100644 --- a/services/web/test/unit/src/User/UserRegistrationHandlerTests.js +++ b/services/web/test/unit/src/User/UserRegistrationHandlerTests.js @@ -40,6 +40,9 @@ describe('UserRegistrationHandler', function() { this.EmailHandler = { sendEmail: sinon.stub().callsArgWith(2) } this.OneTimeTokenHandler = { getNewToken: sinon.stub() } this.handler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../models/User': { User: this.User }, './UserGetter': this.UserGetter, diff --git a/services/web/test/unit/src/User/UserSessionsManagerTests.js b/services/web/test/unit/src/User/UserSessionsManagerTests.js index 7543f92a1a..8f274223ab 100644 --- a/services/web/test/unit/src/User/UserSessionsManagerTests.js +++ b/services/web/test/unit/src/User/UserSessionsManagerTests.js @@ -63,6 +63,9 @@ describe('UserSessionsManager', function() { } } return (this.UserSessionsManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': this.logger, 'settings-sharelatex': this.settings, diff --git a/services/web/test/unit/src/User/UserUpdaterTests.js b/services/web/test/unit/src/User/UserUpdaterTests.js index 3acef2bdf1..b5fb3eaf0d 100644 --- a/services/web/test/unit/src/User/UserUpdaterTests.js +++ b/services/web/test/unit/src/User/UserUpdaterTests.js @@ -46,6 +46,9 @@ describe('UserUpdater', function() { this.refreshFeatures = sinon.stub().yields() this.NewsletterManager = { changeEmail: sinon.stub() } this.UserUpdater = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': this.logger, '../../infrastructure/mongojs': this.mongojs, diff --git a/services/web/test/unit/src/UserMembership/UserMembershipAuthorizationTests.js b/services/web/test/unit/src/UserMembership/UserMembershipAuthorizationTests.js index b940af3ef6..aefe9657dd 100644 --- a/services/web/test/unit/src/UserMembership/UserMembershipAuthorizationTests.js +++ b/services/web/test/unit/src/UserMembership/UserMembershipAuthorizationTests.js @@ -44,6 +44,9 @@ describe('UserMembershipAuthorization', function() { return (this.UserMembershipAuthorization = SandboxedModule.require( modulePath, { + globals: { + console: console + }, requires: { '../Authentication/AuthenticationController': this .AuthenticationController, diff --git a/services/web/test/unit/src/UserMembership/UserMembershipControllerTests.js b/services/web/test/unit/src/UserMembership/UserMembershipControllerTests.js index 7444258672..6bcfe19fd1 100644 --- a/services/web/test/unit/src/UserMembership/UserMembershipControllerTests.js +++ b/services/web/test/unit/src/UserMembership/UserMembershipControllerTests.js @@ -63,6 +63,9 @@ describe('UserMembershipController', function() { return (this.UserMembershipController = SandboxedModule.require( modulePath, { + globals: { + console: console + }, requires: { '../Authentication/AuthenticationController': this .AuthenticationController, diff --git a/services/web/test/unit/src/UserMembership/UserMembershipHandlerTests.js b/services/web/test/unit/src/UserMembership/UserMembershipHandlerTests.js index 9cc9f1802e..6c944b00a3 100644 --- a/services/web/test/unit/src/UserMembership/UserMembershipHandlerTests.js +++ b/services/web/test/unit/src/UserMembership/UserMembershipHandlerTests.js @@ -68,6 +68,9 @@ describe('UserMembershipHandler', function() { create: sinon.stub().yields(null, this.publisher) } return (this.UserMembershipHandler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { './UserMembershipViewModel': this.UserMembershipViewModel, '../User/UserGetter': this.UserGetter, diff --git a/services/web/test/unit/src/UserMembership/UserMembershipViewModelTests.js b/services/web/test/unit/src/UserMembership/UserMembershipViewModelTests.js index 15161b93bd..211d004bb7 100644 --- a/services/web/test/unit/src/UserMembership/UserMembershipViewModelTests.js +++ b/services/web/test/unit/src/UserMembership/UserMembershipViewModelTests.js @@ -26,6 +26,9 @@ describe('UserMembershipViewModel', function() { beforeEach(function() { this.UserGetter = { getUserOrUserStubById: sinon.stub() } this.UserMembershipViewModel = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { mongojs: mongojs, '../User/UserGetter': this.UserGetter diff --git a/services/web/test/unit/src/UserMembership/UserMembershipsHandlerTests.js b/services/web/test/unit/src/UserMembership/UserMembershipsHandlerTests.js index 34ec0b4ec7..797f9aa303 100644 --- a/services/web/test/unit/src/UserMembership/UserMembershipsHandlerTests.js +++ b/services/web/test/unit/src/UserMembership/UserMembershipsHandlerTests.js @@ -25,6 +25,9 @@ describe('UserMembershipsHandler', function() { this.Subscription = { updateMany: sinon.stub().yields(null) } this.Publisher = { updateMany: sinon.stub().yields(null) } return (this.UserMembershipsHandler = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { '../../models/Institution': { Institution: this.Institution diff --git a/services/web/test/unit/src/infrastructure/CsrfTests.js b/services/web/test/unit/src/infrastructure/CsrfTests.js index 35f219f93b..5226b66fd4 100644 --- a/services/web/test/unit/src/infrastructure/CsrfTests.js +++ b/services/web/test/unit/src/infrastructure/CsrfTests.js @@ -24,6 +24,9 @@ describe('Csrf', function() { .stub() .callsArgWith(2, (this.err = { code: 'EBADCSRFTOKEN' })) this.Csrf = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { csurf: sinon.stub().returns(this.csurf_csrf) } @@ -96,6 +99,9 @@ describe('Csrf', function() { it('passes the error on', function() { let err this.Csrf = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { csurf: (this.csurf = sinon .stub() @@ -125,6 +131,9 @@ describe('Csrf', function() { describe('when the request is valid', () => it('calls the callback with `true`', function() { this.Csrf = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { csurf: (this.csurf = sinon .stub() @@ -148,6 +157,9 @@ describe('Csrf', function() { describe('when the request is valid', () => it('calls the callback with `true`', function() { this.Csrf = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { csurf: (this.csurf = sinon .stub() @@ -162,6 +174,9 @@ describe('Csrf', function() { describe('when there is no token', () => it('calls the callback with `false`', function() { this.Csrf = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { csurf: (this.csurf = sinon .stub() diff --git a/services/web/test/unit/src/infrastructure/FaultTolerantRequestTests.js b/services/web/test/unit/src/infrastructure/FaultTolerantRequestTests.js index a2d9b7818a..5f22bf876b 100644 --- a/services/web/test/unit/src/infrastructure/FaultTolerantRequestTests.js +++ b/services/web/test/unit/src/infrastructure/FaultTolerantRequestTests.js @@ -14,6 +14,9 @@ describe('FaultTolerantRequest', function() { err: sinon.stub() } this.FaultTolerantRequest = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { requestretry: this.request, 'logger-sharelatex': this.logger diff --git a/services/web/test/unit/src/infrastructure/GeoIpLookupTests.js b/services/web/test/unit/src/infrastructure/GeoIpLookupTests.js index efe02581bd..192900dc42 100644 --- a/services/web/test/unit/src/infrastructure/GeoIpLookupTests.js +++ b/services/web/test/unit/src/infrastructure/GeoIpLookupTests.js @@ -33,6 +33,9 @@ describe('GeoIpLookup', function() { } this.request = { get: sinon.stub() } this.GeoIpLookup = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { request: this.request, 'settings-sharelatex': this.settings, diff --git a/services/web/test/unit/src/infrastructure/LockManager/getLockTests.js b/services/web/test/unit/src/infrastructure/LockManager/getLockTests.js index 7b2c907586..c805c4bfa4 100644 --- a/services/web/test/unit/src/infrastructure/LockManager/getLockTests.js +++ b/services/web/test/unit/src/infrastructure/LockManager/getLockTests.js @@ -26,6 +26,9 @@ const SandboxedModule = require('sandboxed-module') describe('LockManager - getting the lock', function() { beforeEach(function() { this.LockManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': { log() {} diff --git a/services/web/test/unit/src/infrastructure/LockManager/tryLockTests.js b/services/web/test/unit/src/infrastructure/LockManager/tryLockTests.js index 7235a2f3d5..79a5ca3832 100644 --- a/services/web/test/unit/src/infrastructure/LockManager/tryLockTests.js +++ b/services/web/test/unit/src/infrastructure/LockManager/tryLockTests.js @@ -23,6 +23,9 @@ const SandboxedModule = require('sandboxed-module') describe('LockManager - trying the lock', function() { beforeEach(function() { this.LockManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'logger-sharelatex': { log() {} diff --git a/services/web/test/unit/src/infrastructure/ProxyManagerTests.js b/services/web/test/unit/src/infrastructure/ProxyManagerTests.js index 587fbffd7d..8678b8b3eb 100644 --- a/services/web/test/unit/src/infrastructure/ProxyManagerTests.js +++ b/services/web/test/unit/src/infrastructure/ProxyManagerTests.js @@ -28,6 +28,9 @@ describe('ProxyManager', function() { pipe() {} }) this.proxyManager = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': this.settings, 'logger-sharelatex': { diff --git a/services/web/test/unit/src/infrastructure/RateLimterTests.js b/services/web/test/unit/src/infrastructure/RateLimterTests.js index ccec323bb8..1a8e7596e4 100644 --- a/services/web/test/unit/src/infrastructure/RateLimterTests.js +++ b/services/web/test/unit/src/infrastructure/RateLimterTests.js @@ -69,6 +69,9 @@ describe('RateLimiter', function() { return sinon.stub().callsArgWith(1, null, 0, 22) } return (this.limiter = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: this.requires })) }) @@ -104,6 +107,9 @@ describe('RateLimiter', function() { return sinon.stub().callsArgWith(1, null, 4000, 0) } return (this.limiter = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: this.requires })) }) @@ -144,6 +150,9 @@ describe('RateLimiter', function() { return sinon.stub().callsArgWith(1, new Error('woops')) } return (this.limiter = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: this.requires })) }) diff --git a/services/web/test/unit/src/infrastructure/RedisWrapperTests.js b/services/web/test/unit/src/infrastructure/RedisWrapperTests.js index 259f452f6d..2245a9bc47 100644 --- a/services/web/test/unit/src/infrastructure/RedisWrapperTests.js +++ b/services/web/test/unit/src/infrastructure/RedisWrapperTests.js @@ -23,6 +23,9 @@ describe('RedisWrapper', function() { this.settings = { redis: {} } this.redis = { createClient: sinon.stub() } return (this.RedisWrapper = SandboxedModule.require(modulePath, { + globals: { + console: console + }, requires: { 'settings-sharelatex': this.settings, 'redis-sharelatex': this.redis