From 5970f1df9ed3a49d8d7bd8b00b8e799ac3101150 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Thu, 18 Feb 2021 15:54:48 +0000 Subject: [PATCH] Split out old boot method from test utils - clearly mark what counts as "boot" so we can swap it for new boot --- test/utils/index.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/test/utils/index.js b/test/utils/index.js index 19b7246207..e159d3177e 100644 --- a/test/utils/index.js +++ b/test/utils/index.js @@ -215,6 +215,20 @@ const restartModeGhostStart = async () => { events.emit('server.start'); }; +const bootGhost = async (options) => { + // Require Ghost + ghostServer = await ghost(); + + // Mount Ghost & Start Server + if (options.subdir) { + let parentApp = express('test parent'); + parentApp.use(urlUtils.getSubdir(), ghostServer.rootApp); + await ghostServer.start(parentApp); + } else { + await ghostServer.start(); + } +}; + // CASE: Ghost Server needs Starting // In this case we need to ensure that Ghost is started cleanly: // - ensure the DB is reset @@ -253,17 +267,8 @@ const freshModeGhostStart = async (options) => { // @TODO: Prob B: why/how is this different to urlService.reset? urlService.resetGenerators(); - // Require Ghost - ghostServer = await ghost(); - - // Mount Ghost & Start Server - if (options.subdir) { - let parentApp = express('test parent'); - parentApp.use(urlUtils.getSubdir(), ghostServer.rootApp); - await ghostServer.start(parentApp); - } else { - await ghostServer.start(); - } + // Actually boot Ghost + await bootGhost(options); // Ensure readiness was called (this is idempotent) GhostServer.announceServerReadiness();