frack-settings
Advanced tools
Comparing version 0.1.8 to 0.1.9
{ | ||
"name": "frack-settings", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"description": "Settings defaults and runtime loader from rc file", | ||
@@ -31,3 +31,3 @@ "license": "MIT", | ||
"dev": "rollup -c -w", | ||
"test": "cross-env APP_ENV=production jest --no-cache", | ||
"test": "jest --no-cache", | ||
"coverage": "npm test -- --coverage", | ||
@@ -57,3 +57,6 @@ "postcoverage": "opn coverage/lcov-report/index.html", | ||
"^.+\\.js?$": "babel-jest" | ||
} | ||
}, | ||
"testPathIgnorePatterns": [ | ||
".frackrc.js" | ||
] | ||
}, | ||
@@ -60,0 +63,0 @@ "keywords": [ |
import frackSettings from '../frackSettings' | ||
it('should load settings', () => { | ||
it('should load default settings', () => { | ||
process.chdir(__dirname) | ||
const settings = frackSettings() | ||
expect(settings).not.toBeFalsy() | ||
expect(settings.appMode).toBe('development') // from section development, cause development is the default PYČO! | ||
expect(settings.redisPort).toBe(6380) // from section development, cause development is the default PYČO! | ||
}) | ||
it('should load production settings', () => { | ||
process.chdir(__dirname) | ||
process.env.APP_ENV = 'production' | ||
const settings = frackSettings() | ||
expect(settings).not.toBeFalsy() | ||
expect(settings.appMode).toBe('production') // from section production | ||
expect(settings.redisPort).toBe(6381) // from section production | ||
}) | ||
it('should load another settings', () => { | ||
process.chdir(__dirname) | ||
process.env.APP_ENV = 'someSection' | ||
const settings = frackSettings() | ||
expect(settings).not.toBeFalsy() | ||
expect(settings.redisPort).toBe(6382) // from section production | ||
}) | ||
it('should fail load non-existing section', () => { | ||
process.chdir(__dirname) | ||
process.env.APP_ENV = 'iDontExistDude' | ||
expect(() => { | ||
const settings = frackSettings() // eslint-disable-line no-unused-vars | ||
}).toThrow() | ||
}) |
@@ -42,3 +42,3 @@ /* eslint-disable global-require */ | ||
guards.checkAppEnv(settings, currentEnv) | ||
return deepMerge(settings[currentEnv], settings.common) | ||
return deepMerge(settings.common, settings[currentEnv]) | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
214853
12
6275
10