File tree Expand file tree Collapse file tree 3 files changed +35
-17
lines changed Expand file tree Collapse file tree 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');
1919var paths = require ( './paths' ) ;
2020
2121var sequence = {
22- ' development' : [
22+ development : [
2323 paths . dotenvDevelopmentLocal ,
2424 paths . dotenvDevelopment ,
2525 paths . dotenvLocal ,
26- paths . dotenv
26+ paths . dotenv ,
2727 ] ,
28- ' test' : [
28+ test : [
2929 paths . dotenvTestLocal ,
3030 paths . dotenvTest ,
3131 paths . dotenvLocal ,
32- paths . dotenv
32+ paths . dotenv ,
3333 ] ,
34- ' production' : [
34+ production : [
3535 paths . dotenvProductionLocal ,
3636 paths . dotenvProduction ,
3737 paths . dotenvLocal ,
38- paths . dotenv
39- ]
38+ paths . dotenv ,
39+ ] ,
4040} ;
4141
4242var envConfigs = sequence [ process . env . NODE_ENV ] ;
@@ -46,7 +46,7 @@ if (envConfigs) {
4646 if ( fs . existsSync ( envConfig ) ) {
4747 require ( 'dotenv' ) . config ( {
4848 silent : true ,
49- path : envConfig
49+ path : envConfig ,
5050 } ) ;
5151 }
5252 } ) ;
Original file line number Diff line number Diff line change @@ -15,15 +15,27 @@ describe('Integration', () => {
1515 it ( 'file env variables' , async ( ) => {
1616 const doc = await initDOM ( 'file-env-variables' ) ;
1717
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' ) ;
2024
2125 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+ ) ;
2432 } 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+ ) ;
2739 }
2840 } ) ;
2941
Original file line number Diff line number Diff line change @@ -11,9 +11,15 @@ import React from 'react';
1111
1212export default ( ) => (
1313 < 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 >
1723 < span id = "feature-file-env-x" > { process . env . REACT_APP_X } </ span >
1824 </ span >
1925) ;
You can’t perform that action at this time.
0 commit comments