mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 14:03:48 +03:00
Revert "Improve the performance of prepareContentFolder"
This reverts commit bfacca3035
.
This commit is contained in:
parent
30c27ee1c3
commit
af075c063e
@ -12,10 +12,7 @@ describe('Settings API', function () {
|
||||
let request;
|
||||
|
||||
before(async function () {
|
||||
await localUtils.startGhost({
|
||||
redirectsFile: true,
|
||||
copySettings: true
|
||||
});
|
||||
await localUtils.startGhost();
|
||||
request = supertest.agent(config.get('url'));
|
||||
await localUtils.doAuth(request);
|
||||
});
|
||||
|
@ -5,6 +5,7 @@ const fs = require('fs');
|
||||
const _ = require('lodash');
|
||||
const supertest = require('supertest');
|
||||
const nock = require('nock');
|
||||
const testUtils = require('../../utils');
|
||||
const config = require('../../../core/shared/config');
|
||||
const localUtils = require('./utils');
|
||||
const settingsCache = require('../../../core/shared/settings-cache');
|
||||
@ -25,9 +26,10 @@ describe('Themes API', function () {
|
||||
};
|
||||
|
||||
before(async function () {
|
||||
await localUtils.startGhost({
|
||||
copyThemes: true
|
||||
});
|
||||
// NOTE: this flag should not be here! the URL service re-initialization should be fixed instead
|
||||
// The reason why this init doesn't work without "forceStart" is because during the "restartModeGhostStart"
|
||||
// the routing.routerManager is never called with "start". That's why a full boot is needed
|
||||
await localUtils.startGhost();
|
||||
ownerRequest = supertest.agent(config.get('url'));
|
||||
await localUtils.doAuth(ownerRequest);
|
||||
});
|
||||
|
@ -51,9 +51,7 @@ describe('Front-end members behaviour', function () {
|
||||
|
||||
return originalSettingsCacheGetFn(key, options);
|
||||
});
|
||||
await testUtils.startGhost({
|
||||
copyThemes: true
|
||||
});
|
||||
await testUtils.startGhost();
|
||||
await testUtils.initFixtures('members');
|
||||
request = supertest.agent(configUtils.config.get('url'));
|
||||
});
|
||||
|
@ -81,9 +81,6 @@ const prepareContentFolder = (options) => {
|
||||
if (options.copyThemes) {
|
||||
// Copy all themes into the new test content folder. Default active theme is always casper. If you want to use a different theme, you have to set the active theme (e.g. stub)
|
||||
fs.copySync(path.join(__dirname, 'fixtures', 'themes'), path.join(contentFolderForTests, 'themes'));
|
||||
} else if (options.frontend) {
|
||||
// Just copy Casper
|
||||
fs.copySync(path.join(__dirname, 'fixtures', 'themes', 'casper'), path.join(contentFolderForTests, 'themes', 'casper'));
|
||||
}
|
||||
|
||||
if (options.redirectsFile) {
|
||||
@ -102,7 +99,7 @@ const prepareContentFolder = (options) => {
|
||||
// - truncate database
|
||||
// - re-run default fixtures
|
||||
// - reload affected services
|
||||
const restartModeGhostStart = async ({frontend, copyThemes, copySettings}) => {
|
||||
const restartModeGhostStart = async ({frontend}) => {
|
||||
debug('Reload Mode');
|
||||
|
||||
// TODO: figure out why we need this if we reset again later?
|
||||
@ -116,12 +113,11 @@ const restartModeGhostStart = async ({frontend, copyThemes, copySettings}) => {
|
||||
await settingsService.init();
|
||||
debug('settings done');
|
||||
|
||||
if (copySettings) {
|
||||
if (frontend) {
|
||||
// Load the frontend-related components
|
||||
await routeSettingsService.init();
|
||||
}
|
||||
if (copyThemes) {
|
||||
await themeService.init();
|
||||
await themeService.loadInactiveThemes();
|
||||
debug('frontend done');
|
||||
}
|
||||
|
||||
// Reload the URL service & wait for it to be ready again
|
||||
@ -199,17 +195,19 @@ const startGhost = async (options) => {
|
||||
options = _.merge({
|
||||
backend: true,
|
||||
frontend: true,
|
||||
redirectsFile: false,
|
||||
redirectsFile: true,
|
||||
redirectsFileExt: '.json',
|
||||
forceStart: false,
|
||||
copyThemes: false,
|
||||
copySettings: false,
|
||||
copyThemes: true,
|
||||
copySettings: true,
|
||||
contentFolder: path.join(os.tmpdir(), uuid.v4(), 'ghost-test'),
|
||||
subdir: false
|
||||
}, options);
|
||||
|
||||
// Ensure we have tmp content folders populated ready for testing
|
||||
// @TODO: tidy up the tmp folders after tests
|
||||
prepareContentFolder(options);
|
||||
|
||||
|
||||
if (ghostServer && ghostServer.httpServer && !options.forceStart) {
|
||||
await restartModeGhostStart(options);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user