mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
parent
a98efe1b68
commit
c8691a85c5
1 changed files with 3 additions and 5 deletions
|
@ -40,9 +40,7 @@ function findFreePort(port) {
|
||||||
|
|
||||||
// Creates a new fork of Ghost process with a given config
|
// Creates a new fork of Ghost process with a given config
|
||||||
// Useful for tests that want to verify certain config options
|
// Useful for tests that want to verify certain config options
|
||||||
function forkGhost(newConfig, envName) {
|
function forkGhost(newConfig) {
|
||||||
envName = envName || 'forked';
|
|
||||||
|
|
||||||
return findFreePort()
|
return findFreePort()
|
||||||
.then(function (port) {
|
.then(function (port) {
|
||||||
newConfig.server = _.merge({}, {
|
newConfig.server = _.merge({}, {
|
||||||
|
@ -61,7 +59,7 @@ function forkGhost(newConfig, envName) {
|
||||||
rotation: false
|
rotation: false
|
||||||
};
|
};
|
||||||
|
|
||||||
var newConfigFile = path.join(config.get('paths').appRoot, 'config.test.' + envName + '.json');
|
var newConfigFile = path.join(config.get('paths').appRoot, 'config.' + config.get('env') + '.json');
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
fs.writeFile(newConfigFile, JSON.stringify(newConfig), function (err) {
|
fs.writeFile(newConfigFile, JSON.stringify(newConfig), function (err) {
|
||||||
|
@ -84,7 +82,7 @@ function forkGhost(newConfig, envName) {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
env.NODE_ENV = 'test.' + envName;
|
env.NODE_ENV = config.get('env');
|
||||||
|
|
||||||
child = cp.fork(path.join(config.get('paths').appRoot, 'index.js'), {env: env});
|
child = cp.fork(path.join(config.get('paths').appRoot, 'index.js'), {env: env});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue