@@ -123,4 +123,34 @@ describe('added .env to gitignore with --compare and --fix', () => {
123123 expect ( res . stdout ) . toContain ( 'file not found' ) ;
124124 expect ( res . stdout ) . toContain ( 'Do you want to create a .env.example file from .env.local?' ) ;
125125 } ) ;
126+
127+ describe ( 'Values mismatch checks' , ( ) => {
128+ it ( 'will report value mismatches when --check-values is set' , ( ) => {
129+ const cwd = tmpDir ( ) ;
130+ fs . writeFileSync ( path . join ( cwd , '.env' ) , 'API_KEY=actual_value\n' ) ;
131+ fs . writeFileSync (
132+ path . join ( cwd , '.env.example' ) ,
133+ 'API_KEY=example_value\n' ,
134+ ) ;
135+
136+ const res = runCli ( cwd , [ '--compare' , '--check-values' ] ) ;
137+ expect ( res . status ) . toBe ( 0 ) ;
138+ expect ( res . stdout ) . toContain ( 'Value mismatches' ) ;
139+ expect ( res . stdout ) . toContain ( 'API_KEY' ) ;
140+ } ) ;
141+
142+ it ( 'will not report value mismatches when --check-values is not set' , ( ) => {
143+ const cwd = tmpDir ( ) ;
144+ fs . writeFileSync ( path . join ( cwd , '.env' ) , 'API_KEY=actual_value\n' ) ;
145+ fs . writeFileSync (
146+ path . join ( cwd , '.env.example' ) ,
147+ 'API_KEY=example_value\n' ,
148+ ) ;
149+
150+ const res = runCli ( cwd , [ '--compare' ] ) ;
151+ expect ( res . status ) . toBe ( 0 ) ;
152+ expect ( res . stdout ) . not . toContain ( 'Value mismatches' ) ;
153+ expect ( res . stdout ) . not . toContain ( 'API_KEY' ) ;
154+ } ) ;
155+ } ) ;
126156} ) ;
0 commit comments