@@ -159,4 +159,36 @@ describe('config-replace', function() {
159159 expect ( newContent ) . to . not . equal ( oldContent ) ;
160160 } ) ;
161161 } ) ;
162+
163+ it ( 'handle nested paths' , function ( ) {
164+ var root , configReplace , builder ;
165+
166+ root = tmp . in ( join ( process . cwd ( ) , 'tmp' ) ) ;
167+
168+ fs . writeFileSync ( join ( root , 'config.json' ) , '{"color":"red"}' ) ;
169+ fs . mkdirSync ( join ( root , 'dir1' ) ) ;
170+ fs . mkdirSync ( join ( root , 'dir1' , 'dir2' ) ) ;
171+ fs . writeFileSync ( join ( root , 'dir1' , 'dir2' , 'index.html' ) , "{{color}}" ) ;
172+
173+ configReplace = new ConfigReplace (
174+ root ,
175+ root , {
176+ files : [ 'dir1/dir2/index.html' ] ,
177+ configPath : 'config.json' ,
178+ patterns : [ {
179+ match : / \{ \{ c o l o r \} \} / g,
180+ replacement : 'red'
181+ } ]
182+ }
183+ ) ;
184+
185+ builder = new broccoli . Builder ( configReplace ) ;
186+
187+ return builder . build ( ) . then ( function ( results ) {
188+ var resultsPath = join ( results . directory , 'dir1' , 'dir2' , 'index.html' ) ,
189+ contents = fs . readFileSync ( resultsPath , { encoding : 'utf8' } ) ;
190+
191+ assert . equal ( contents . trim ( ) , 'red' ) ;
192+ } )
193+ } ) ;
162194} ) ;
0 commit comments