From 51a4a65eece3e508c2a274f42d88592f3ca7f4c0 Mon Sep 17 00:00:00 2001 From: Naz Date: Thu, 2 Dec 2021 12:16:28 +0400 Subject: [PATCH] Enabled frontend-only boot for mock-express tests refs https://github.com/ErisDS/Ghost/commit/3c7a8dead41c78fb1b251b42324387ccc53e3eed - Simplifies the state initialization code significantly and reuses native boot mechanism instead of mimicking it (it was a headache to maintain with all the internal services moving around) --- .../mock-express-style/utils/setup.js | 27 ++++--------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/test/regression/mock-express-style/utils/setup.js b/test/regression/mock-express-style/utils/setup.js index f4048b62cc..070d71b478 100644 --- a/test/regression/mock-express-style/utils/setup.js +++ b/test/regression/mock-express-style/utils/setup.js @@ -2,14 +2,11 @@ const path = require('path'); // Ghost Internals -const models = require('../../../../core/server/models'); const routingService = require('../../../../core/frontend/services/routing'); -const settingsService = require('../../../../core/server/services/settings'); const settingsCache = require('../../../../core/shared/settings-cache'); const imageLib = require('../../../../core/server/lib/image'); -const appService = require('../../../../core/frontend/services/apps'); -const siteApp = require('../../../../core/server/web/parent/app'); +const boot = require('../../../../core/boot'); // Other Test Utilities const configUtils = require('../../../utils/configUtils'); @@ -48,25 +45,11 @@ module.exports = { * @returns {object} express App */ initGhost: async () => { - models.init(); - await settingsService.init(); - urlServiceUtils.init(); - - const customRedirects = require('../../../../core/server/services/redirects'); - await customRedirects.init(); - const routeSettings = require('../../../../core/server/services/route-settings'); - await routeSettings.init(); - const customThemeSettingsService = require('../../../../core/server/services/custom-theme-settings'); - customThemeSettingsService.init(); - const themeService = require('../../../../core/server/services/themes'); - await themeService.init(); - const helperService = require('../../../../core/frontend/services/helpers'); - await helperService.init(); - - const app = siteApp({ - start: true + const app = await boot({ + server: false, + backend: false }); - await appService.init(); + await urlServiceUtils.isFinished(); return app;