mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Added test util to load instance with custom routes
https://github.com/TryGhost/Toolbox/issues/140 - Allows to fully start an instance with a custom routes.yaml file without a need to do workarounds - e.g. we used to call an internal Admin API from a regression test suite, which is not a good practice - Providing "routesFilePath" to startGhost method copies that file to the default settings location and start the instance with that configuration. No need to do API calls or check if the routing service "isFinished"
This commit is contained in:
parent
6b81b3db02
commit
961c29dc72
1 changed files with 18 additions and 1 deletions
|
@ -87,7 +87,9 @@ const prepareContentFolder = (options) => {
|
|||
redirects.setupFile(contentFolderForTests, options.redirectsFileExt);
|
||||
}
|
||||
|
||||
if (options.copySettings) {
|
||||
if (options.routesFilePath) {
|
||||
fs.copySync(options.routesFilePath, path.join(contentFolderForTests, 'settings', 'routes.yaml'));
|
||||
} else if (options.copySettings) {
|
||||
fs.copySync(path.join(__dirname, 'fixtures', 'settings', 'routes.yaml'), path.join(contentFolderForTests, 'settings', 'routes.yaml'));
|
||||
}
|
||||
};
|
||||
|
@ -180,6 +182,21 @@ const freshModeGhostStart = async (options) => {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Object} [options]
|
||||
* @param {boolean} [options.backend]
|
||||
* @param {boolean} [options.frontend]
|
||||
* @param {boolean} [options.redirectsFile]
|
||||
* @param {String} [options.redirectsFileExt]
|
||||
* @param {boolean} [options.forceStart]
|
||||
* @param {boolean} [options.copyThemes]
|
||||
* @param {boolean} [options.copySettings]
|
||||
* @param {String} [options.routesFilePath] - path to a routes configuration file to start the instance with
|
||||
* @param {String} [options.contentFolder]
|
||||
* @param {boolean} [options.subdir]
|
||||
* @returns {Promise<GhostServer>}
|
||||
*/
|
||||
const startGhost = async (options) => {
|
||||
const startTime = Date.now();
|
||||
debug('Start Ghost');
|
||||
|
|
Loading…
Add table
Reference in a new issue