File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed
packages/schematics/angular/ng-new Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,8 @@ import {
10
10
SchematicContext ,
11
11
SchematicsException ,
12
12
Tree ,
13
- apply ,
13
+ branchAndMerge ,
14
14
chain ,
15
- empty ,
16
- mergeWith ,
17
15
move ,
18
16
schematic ,
19
17
} from '@angular-devkit/schematics' ;
@@ -55,14 +53,14 @@ export default function (options: NgNewOptions): Rule {
55
53
} ;
56
54
57
55
return chain ( [
58
- mergeWith (
59
- apply ( empty ( ) , [
56
+ branchAndMerge (
57
+ chain ( [
60
58
schematic ( 'workspace' , workspaceOptions ) ,
61
59
schematic ( 'application' , applicationOptions ) ,
62
60
move ( options . directory || options . name ) ,
63
61
] ) ,
64
62
) ,
65
- ( host : Tree , context : SchematicContext ) => {
63
+ ( _host : Tree , context : SchematicContext ) => {
66
64
let packageTask ;
67
65
if ( ! options . skipInstall ) {
68
66
packageTask = context . addTask ( new NodePackageInstallTask ( options . directory ) ) ;
Original file line number Diff line number Diff line change @@ -46,4 +46,15 @@ describe('Ng New Schematic', () => {
46
46
const content = tree . readContent ( '/bar/angular.json' ) ;
47
47
expect ( content ) . toMatch ( / " p r e f i x " : " p r e " / ) ;
48
48
} ) ;
49
+
50
+ it ( 'should set up the app module' , ( ) => {
51
+ const options : NgNewOptions = {
52
+ name : 'foo' ,
53
+ version : '6.0.0' ,
54
+ } ;
55
+
56
+ const tree = schematicRunner . runSchematic ( 'ng-new' , options ) ;
57
+ const moduleContent = tree . readContent ( '/foo/src/app/app.module.ts' ) ;
58
+ expect ( moduleContent ) . toMatch ( / d e c l a r a t i o n s : \s * \[ \s * A p p C o m p o n e n t \s * \] / m) ;
59
+ } ) ;
49
60
} ) ;
You can’t perform that action at this time.
0 commit comments