From 149c100b4c5d12fd724665a354ed7500faa95546 Mon Sep 17 00:00:00 2001 From: Naz Date: Fri, 19 Nov 2021 18:26:23 +0400 Subject: [PATCH] Fixed frontend initialization in "mock-express" tests refs https://github.com/TryGhost/Toolbox/issues/135 - Without sensible defaults the web app was not initializing either the backend nor the frontned parts of the application. Fixed the defaults so the problem doesn't happen again and optimized mock-express-style initialization to only initialize the frontend routing --- core/server/web/parent/app.js | 6 +++--- test/regression/mock-express-style/utils/setup.js | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/core/server/web/parent/app.js b/core/server/web/parent/app.js index 5533cc2662..587ebe1fab 100644 --- a/core/server/web/parent/app.js +++ b/core/server/web/parent/app.js @@ -8,10 +8,10 @@ const vhost = require('@tryghost/vhost-middleware'); /** * @param {Object} options * @param {Boolean} [options.start] - * @param {Boolean} options.withBackend - * @param {Boolean} options.withFrontend + * @param {Boolean} [options.withBackend] + * @param {Boolean} [options.withFrontend] */ -module.exports = function setupParentApp({start, withFrontend, withBackend}) { +module.exports = function setupParentApp({start, withFrontend = true, withBackend = true}) { debug('ParentApp setup start'); const parentApp = express('parent'); diff --git a/test/regression/mock-express-style/utils/setup.js b/test/regression/mock-express-style/utils/setup.js index 5ffd75ec03..511140ece3 100644 --- a/test/regression/mock-express-style/utils/setup.js +++ b/test/regression/mock-express-style/utils/setup.js @@ -59,7 +59,9 @@ module.exports = { const helperService = require('../../../../core/frontend/services/helpers'); await helperService.init(); - const app = siteApp({start: true}); + const app = siteApp({ + start: true + }); await appService.init(); await urlServiceUtils.isFinished();