Skip to content
This repository was archived by the owner on Aug 30, 2021. It is now read-only.

Commit d188326

Browse files
committed
Fixed issue where if local.js exists then grunt test will run on that environment config and possibly delete collections
We only extend the config object with the local.js custom/local environment if we are on production or development environment. If test environment is used we don't merge it with local.js to avoid running test suites on a prod/dev environment (which delete records and make modifications)
1 parent 98f3e8c commit d188326

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

config/config.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,14 @@ var initGlobalConfig = function () {
159159
var environmentConfig = require(path.join(process.cwd(), 'config/env/', process.env.NODE_ENV)) || {};
160160

161161
// Merge config files
162-
var envConf = _.merge(defaultConfig, environmentConfig);
162+
var config = _.merge(defaultConfig, environmentConfig);
163163

164-
var config = _.merge(envConf, (fs.existsSync(path.join(process.cwd(), 'config/env/local.js')) && require(path.join(process.cwd(), 'config/env/local.js'))) || {});
164+
// We only extend the config object with the local.js custom/local environment if we are on
165+
// production or development environment. If test environment is used we don't merge it with local.js
166+
// to avoid running test suites on a prod/dev environment (which delete records and make modifications)
167+
if (process.env.NODE_ENV !== 'test') {
168+
config = _.merge(config, (fs.existsSync(path.join(process.cwd(), 'config/env/local.js')) && require(path.join(process.cwd(), 'config/env/local.js'))) || {});
169+
}
165170

166171
// Initialize global globbed files
167172
initGlobalConfigFiles(config, assets);

0 commit comments

Comments
 (0)