File tree 3 files changed +35
-17
lines changed
3 files changed +35
-17
lines changed Original file line number Diff line number Diff line change @@ -19,24 +19,24 @@ var fs = require('fs');
19
19
var paths = require ( './paths' ) ;
20
20
21
21
var sequence = {
22
- ' development' : [
22
+ development : [
23
23
paths . dotenvDevelopmentLocal ,
24
24
paths . dotenvDevelopment ,
25
25
paths . dotenvLocal ,
26
- paths . dotenv
26
+ paths . dotenv ,
27
27
] ,
28
- ' test' : [
28
+ test : [
29
29
paths . dotenvTestLocal ,
30
30
paths . dotenvTest ,
31
31
paths . dotenvLocal ,
32
- paths . dotenv
32
+ paths . dotenv ,
33
33
] ,
34
- ' production' : [
34
+ production : [
35
35
paths . dotenvProductionLocal ,
36
36
paths . dotenvProduction ,
37
37
paths . dotenvLocal ,
38
- paths . dotenv
39
- ]
38
+ paths . dotenv ,
39
+ ] ,
40
40
} ;
41
41
42
42
var envConfigs = sequence [ process . env . NODE_ENV ] ;
@@ -46,7 +46,7 @@ if (envConfigs) {
46
46
if ( fs . existsSync ( envConfig ) ) {
47
47
require ( 'dotenv' ) . config ( {
48
48
silent : true ,
49
- path : envConfig
49
+ path : envConfig ,
50
50
} ) ;
51
51
}
52
52
} ) ;
Original file line number Diff line number Diff line change @@ -15,15 +15,27 @@ describe('Integration', () => {
15
15
it ( 'file env variables' , async ( ) => {
16
16
const doc = await initDOM ( 'file-env-variables' ) ;
17
17
18
- expect ( doc . getElementById ( 'feature-file-env-original-1' ) . textContent ) . to . equal ( 'from-original-env-1' ) ;
19
- expect ( doc . getElementById ( 'feature-file-env-original-2' ) . textContent ) . to . equal ( 'override-from-original-local-env-2' ) ;
18
+ expect (
19
+ doc . getElementById ( 'feature-file-env-original-1' ) . textContent
20
+ ) . to . equal ( 'from-original-env-1' ) ;
21
+ expect (
22
+ doc . getElementById ( 'feature-file-env-original-2' ) . textContent
23
+ ) . to . equal ( 'override-from-original-local-env-2' ) ;
20
24
21
25
if ( process . env . NODE_ENV === 'production' ) {
22
- expect ( doc . getElementById ( 'feature-file-env' ) . textContent ) . to . equal ( 'production' )
23
- expect ( doc . getElementById ( 'feature-file-env-x' ) . textContent ) . to . equal ( 'x-from-production-env' )
26
+ expect ( doc . getElementById ( 'feature-file-env' ) . textContent ) . to . equal (
27
+ 'production'
28
+ ) ;
29
+ expect ( doc . getElementById ( 'feature-file-env-x' ) . textContent ) . to . equal (
30
+ 'x-from-production-env'
31
+ ) ;
24
32
} else {
25
- expect ( doc . getElementById ( 'feature-file-env' ) . textContent ) . to . equal ( 'development' )
26
- expect ( doc . getElementById ( 'feature-file-env-x' ) . textContent ) . to . equal ( 'x-from-development-env' )
33
+ expect ( doc . getElementById ( 'feature-file-env' ) . textContent ) . to . equal (
34
+ 'development'
35
+ ) ;
36
+ expect ( doc . getElementById ( 'feature-file-env-x' ) . textContent ) . to . equal (
37
+ 'x-from-development-env'
38
+ ) ;
27
39
}
28
40
} ) ;
29
41
Original file line number Diff line number Diff line change @@ -11,9 +11,15 @@ import React from 'react';
11
11
12
12
export default ( ) => (
13
13
< span >
14
- < span id = "feature-file-env-original-1" > { process . env . REACT_APP_ORIGINAL_1 } </ span >
15
- < span id = "feature-file-env-original-2" > { process . env . REACT_APP_ORIGINAL_2 } </ span >
16
- < span id = "feature-file-env" > { process . env . REACT_APP_DEVELOPMENT } { process . env . REACT_APP_PRODUCTION } </ span >
14
+ < span id = "feature-file-env-original-1" >
15
+ { process . env . REACT_APP_ORIGINAL_1 }
16
+ </ span >
17
+ < span id = "feature-file-env-original-2" >
18
+ { process . env . REACT_APP_ORIGINAL_2 }
19
+ </ span >
20
+ < span id = "feature-file-env" >
21
+ { process . env . REACT_APP_DEVELOPMENT } { process . env . REACT_APP_PRODUCTION }
22
+ </ span >
17
23
< span id = "feature-file-env-x" > { process . env . REACT_APP_X } </ span >
18
24
</ span >
19
25
) ;
You can’t perform that action at this time.
0 commit comments