| 
									
										
										
										
											2018-03-01 10:41:35 -08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							| 
									
										
										
										
											2020-05-19 12:08:49 -07:00
										 |  |  |  * Copyright Google LLC All Rights Reserved. | 
					
						
							| 
									
										
										
										
											2018-03-01 10:41:35 -08:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Use of this source code is governed by an MIT-style license that can be | 
					
						
							|  |  |  |  * found in the LICENSE file at https://angular.io/license
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-02 14:19:01 -08:00
										 |  |  | import * as chai from 'chai'; | 
					
						
							|  |  |  | import * as fs from 'fs'; | 
					
						
							|  |  |  | import * as path from 'path'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export function unlinkRecursively(file: string) { | 
					
						
							|  |  |  |   if (fs.statSync(file).isDirectory()) { | 
					
						
							|  |  |  |     for (const f of fs.readdirSync(file)) { | 
					
						
							|  |  |  |       unlinkRecursively(path.join(file, f)); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     fs.rmdirSync(file); | 
					
						
							|  |  |  |   } else { | 
					
						
							|  |  |  |     fs.unlinkSync(file); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export function assertFileEqual(actualFile: string, expectedFile: string) { | 
					
						
							|  |  |  |   chai.assert.equal( | 
					
						
							|  |  |  |       fs.readFileSync(actualFile).toString(), fs.readFileSync(expectedFile).toString()); | 
					
						
							|  |  |  | } |