File tree Expand file tree Collapse file tree 2 files changed +25
-7
lines changed
src/lib/schematics/update Expand file tree Collapse file tree 2 files changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -81,19 +81,15 @@ export default function(): Rule {
8181 // Delete the temporary schematics directory.
8282 context . addTask (
8383 new RunSchematicTask ( 'ng-post-update' , {
84- deleteFiles : updateSrcs
85- . map ( entry => entry . path . replace ( schematicsSrcPath , schematicsTmpPath ) )
84+ deletePath : schematicsTmpPath
8685 } ) , [ upgradeTask ] ) ;
8786 } ;
8887}
8988
9089/** Post-update schematic to be called when ng update is finished. */
91- export function postUpdate ( options : { deleteFiles : string [ ] } ) : Rule {
90+ export function postUpdate ( options : { deletePath : string } ) : Rule {
9291 return ( tree : Tree , context : SchematicContext ) => {
93- for ( let file of options . deleteFiles ) {
94- tree . delete ( file ) ;
95- }
96-
92+ tree . delete ( options . deletePath ) ;
9793 context . addTask ( new RunSchematicTask ( 'ng-post-post-update' , { } ) ) ;
9894 } ;
9995}
Original file line number Diff line number Diff line change 1+ import { SchematicTestRunner } from '@angular-devkit/schematics/testing' ;
2+ import { join } from 'path' ;
3+ import { Tree } from '@angular-devkit/schematics' ;
4+ import { createTestApp } from '../utils/testing' ;
5+ import { getFileContent } from '@schematics/angular/utility/test' ;
6+
7+ const collectionPath = join ( __dirname , '../collection.json' ) ;
8+
9+ describe ( 'material-nav-schematic' , ( ) => {
10+ let runner : SchematicTestRunner ;
11+
12+ beforeEach ( ( ) => {
13+ runner = new SchematicTestRunner ( 'schematics' , collectionPath ) ;
14+ } ) ;
15+
16+ it ( 'should remove the temp directory' , ( ) => {
17+ const tree = runner . runSchematic ( 'update' , { } , createTestApp ( ) ) ;
18+ const files = tree . files ;
19+ expect ( files . find ( file => file . includes ( 'angular_material_schematics-' ) ) ) . toBeTruthy ( ) ;
20+ } ) ;
21+
22+ } ) ;
You can’t perform that action at this time.
0 commit comments