mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
Enabled frontend-only boot for mock-express tests
refs 3c7a8dead4
- 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)
This commit is contained in:
parent
de121e1219
commit
51a4a65eec
@ -2,14 +2,11 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
// Ghost Internals
|
// Ghost Internals
|
||||||
const models = require('../../../../core/server/models');
|
|
||||||
const routingService = require('../../../../core/frontend/services/routing');
|
const routingService = require('../../../../core/frontend/services/routing');
|
||||||
const settingsService = require('../../../../core/server/services/settings');
|
|
||||||
const settingsCache = require('../../../../core/shared/settings-cache');
|
const settingsCache = require('../../../../core/shared/settings-cache');
|
||||||
const imageLib = require('../../../../core/server/lib/image');
|
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
|
// Other Test Utilities
|
||||||
const configUtils = require('../../../utils/configUtils');
|
const configUtils = require('../../../utils/configUtils');
|
||||||
@ -48,25 +45,11 @@ module.exports = {
|
|||||||
* @returns {object} express App
|
* @returns {object} express App
|
||||||
*/
|
*/
|
||||||
initGhost: async () => {
|
initGhost: async () => {
|
||||||
models.init();
|
const app = await boot({
|
||||||
await settingsService.init();
|
server: false,
|
||||||
urlServiceUtils.init();
|
backend: false
|
||||||
|
|
||||||
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
|
|
||||||
});
|
});
|
||||||
await appService.init();
|
|
||||||
await urlServiceUtils.isFinished();
|
await urlServiceUtils.isFinished();
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
|
Loading…
Reference in New Issue
Block a user