dotenv-defaults 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,9 +5,7 @@ A dotenv system that supports defaults
5
5
  ### Status
6
6
 
7
7
  ![npm](https://img.shields.io/npm/v/dotenv-defaults.svg)
8
- ![David](https://img.shields.io/david/mrsteele/dotenv-defaults.svg)
9
- ![David](https://img.shields.io/david/dev/mrsteele/dotenv-defaults.svg)
10
-
8
+ [![Greenkeeper badge](https://badges.greenkeeper.io/mrsteele/dotenv-defaults.svg)](https://greenkeeper.io/)
11
9
 
12
10
  ### Installation
13
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dotenv-defaults",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "dotenv... but with defaults!",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -30,7 +30,7 @@
30
30
  ],
31
31
  "homepage": "https://github.com/mrsteele/dotenv-defaults#readme",
32
32
  "dependencies": {
33
- "dotenv": "^5.0.1"
33
+ "dotenv": "^6.2.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "jest": "^23.6.0",
package/src/index.js CHANGED
@@ -33,7 +33,9 @@ const config = (options = {}) => {
33
33
  path: options.defaults || '.env.defaults'
34
34
  }))
35
35
 
36
- return merge(src, defaults)
36
+ return {
37
+ parsed: merge(src.parsed, defaults.parsed)
38
+ }
37
39
  }
38
40
 
39
41
  const load = config
package/src/index.test.js CHANGED
@@ -1,4 +1,4 @@
1
- /* global describe, test, expect */
1
+ /* global describe, test, expect, afterEach */
2
2
 
3
3
  const Module = require('./index')
4
4
 
@@ -10,8 +10,33 @@ describe('dotenv-defaults', () => {
10
10
  })
11
11
 
12
12
  describe('config', () => {
13
- test('should write some of these...', () => {
14
- expect(true).toEqual(true)
13
+ afterEach(() => {
14
+ delete process.env.TEST
15
+ delete process.env.TEST2
16
+ })
17
+
18
+ test('should be a function', () => {
19
+ expect(typeof Module.config).toEqual('function')
20
+ })
21
+
22
+ test('should by default write to process.env', () => {
23
+ expect(Module.config()).toEqual({
24
+ parsed: {
25
+ TEST: 'hello',
26
+ TEST2: 'whatever'
27
+ }
28
+ })
29
+ })
30
+
31
+ test('should support alternative defaults', () => {
32
+ expect(Module.config({
33
+ defaults: '.env.defaults2'
34
+ })).toEqual({
35
+ parsed: {
36
+ TEST: 'hello',
37
+ TEST2: 'whatever2'
38
+ }
39
+ })
15
40
  })
16
41
  })
17
42