mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 18:01:36 +03:00
008b6e0fae
refs https://github.com/TryGhost/Toolbox/issues/135 - When running e2e-API test in most cases there's no need to boot Ghost instance with full frontend. This should improve the boot time which should reflect on the speed of running test suites - The tests where the "forceStart" and "withFrontend" are used together indicate that there's still some work to do to fully separate frontend/backend boot line. The force start is also unnecessary, but was needed to reinitialize all services properly - should be investigated!
32 lines
825 B
JavaScript
32 lines
825 B
JavaScript
const urlService = require('../../core/server/services/url');
|
|
|
|
module.exports.isFinished = async (options = {disableDbReadyEvent: false}) => {
|
|
let timeout;
|
|
|
|
return new Promise(function (resolve) {
|
|
(function retry() {
|
|
clearTimeout(timeout);
|
|
|
|
if (urlService.hasFinished()) {
|
|
return resolve();
|
|
}
|
|
|
|
timeout = setTimeout(retry, 50);
|
|
})();
|
|
});
|
|
};
|
|
|
|
// @TODO: unify all the reset/softTeset helpers so they either work how the main code works or the reasons why they are different are clear
|
|
module.exports.init = ({urlCache}) => {
|
|
urlService.init({urlCache});
|
|
};
|
|
|
|
module.exports.reset = () => {
|
|
urlService.softReset();
|
|
},
|
|
|
|
module.exports.resetGenerators = () => {
|
|
urlService.resetGenerators();
|
|
urlService.resources.reset();
|
|
};
|