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

Commit

Permalink
Merge pull request #824 from lirantal/bugfix/localjs-env-params-used-…
Browse files Browse the repository at this point in the history
…for-tests

Fixed issue where if local.js exists then grunt test will run on that…
  • Loading branch information
lirantal committed Aug 19, 2015
2 parents a1570c4 + d188326 commit 2e8d659
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,14 @@ var initGlobalConfig = function () {
var environmentConfig = require(path.join(process.cwd(), 'config/env/', process.env.NODE_ENV)) || {};

// Merge config files
var envConf = _.merge(defaultConfig, environmentConfig);
var config = _.merge(defaultConfig, environmentConfig);

var config = _.merge(envConf, (fs.existsSync(path.join(process.cwd(), 'config/env/local.js')) && require(path.join(process.cwd(), 'config/env/local.js'))) || {});
// 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)
if (process.env.NODE_ENV !== 'test') {
config = _.merge(config, (fs.existsSync(path.join(process.cwd(), 'config/env/local.js')) && require(path.join(process.cwd(), 'config/env/local.js'))) || {});
}

// Initialize global globbed files
initGlobalConfigFiles(config, assets);
Expand Down

0 comments on commit 2e8d659

Please sign in to comment.