@@ -146,4 +146,53 @@ describe('Modernize Tool', () => {
146146 expect ( fileResult ?. content ) . toBe ( '<app-foo />' ) ;
147147 } ) ;
148148 } ) ;
149+
150+ describe ( 'Integration Tests' , ( ) => {
151+ let tempDir : string ;
152+
153+ beforeEach ( ( ) => {
154+ tempDir = fs . mkdtempSync ( path . join ( tmpdir ( ) , 'modernize-spec-integration-' ) ) ;
155+ fs . mkdirSync ( path . join ( tempDir , 'node_modules' ) ) ;
156+ fs . symlinkSync (
157+ path . resolve ( 'node_modules/@angular-devkit' ) ,
158+ path . join ( tempDir , 'node_modules/@angular-devkit' ) ,
159+ 'dir' ,
160+ ) ;
161+ fs . symlinkSync (
162+ path . resolve ( 'node_modules/typescript' ) ,
163+ path . join ( tempDir , 'node_modules/typescript' ) ,
164+ 'dir' ,
165+ ) ;
166+ } ) ;
167+
168+ afterEach ( ( ) => {
169+ fs . rmSync ( tempDir , { recursive : true , force : true } ) ;
170+ } ) ;
171+
172+ it ( 'should run the self-closing-tags migration' , async ( ) => {
173+ const runfilesRoot = path . join ( __dirname , '../../../../../../../../' ) ;
174+ const outputFile = path . join ( runfilesRoot , 'runfiles.log' ) ;
175+ console . log ( 'Output file:' , outputFile ) ;
176+ fs . writeFileSync ( outputFile , '' ) ;
177+ fs . readdirSync ( runfilesRoot , { recursive : true } ) . forEach ( ( file ) => {
178+ fs . appendFileSync ( outputFile , file + '\n' ) ;
179+ } ) ;
180+
181+ const input : ModernizeInput = {
182+ files : [ { name : 'test.ng.html' , content : '<app-foo></app-foo>' } ] ,
183+ transformations : [ 'self-closing-tags-migration' ] ,
184+ } ;
185+
186+ const result = await runModernization ( input , undefined , tempDir ) ;
187+
188+ if ( ! ( 'files' in result . structuredContent ) || ! result . structuredContent . files ) {
189+ fail ( 'Expected files to be present in the result' ) ;
190+ return ;
191+ }
192+
193+ const fileResult = result . structuredContent . files [ 0 ] ;
194+ expect ( fileResult ?. changed ) . toBe ( true ) ;
195+ expect ( fileResult ?. content ) . toBe ( '<app-foo />' ) ;
196+ } ) ;
197+ } ) ;
149198} ) ;
0 commit comments