This repository was archived by the owner on Apr 4, 2025. It is now read-only.
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 {
1010 SchematicContext ,
1111 SchematicsException ,
1212 Tree ,
13- apply ,
13+ branchAndMerge ,
1414 chain ,
15- empty ,
16- mergeWith ,
1715 move ,
1816 schematic ,
1917} from '@angular-devkit/schematics' ;
@@ -55,14 +53,14 @@ export default function (options: NgNewOptions): Rule {
5553 } ;
5654
5755 return chain ( [
58- mergeWith (
59- apply ( empty ( ) , [
56+ branchAndMerge (
57+ chain ( [
6058 schematic ( 'workspace' , workspaceOptions ) ,
6159 schematic ( 'application' , applicationOptions ) ,
6260 move ( options . directory || options . name ) ,
6361 ] ) ,
6462 ) ,
65- ( host : Tree , context : SchematicContext ) => {
63+ ( _host : Tree , context : SchematicContext ) => {
6664 let packageTask ;
6765 if ( ! options . skipInstall ) {
6866 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', () => {
4646 const content = tree . readContent ( '/bar/angular.json' ) ;
4747 expect ( content ) . toMatch ( / " p r e f i x " : " p r e " / ) ;
4848 } ) ;
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+ } ) ;
4960} ) ;
You can’t perform that action at this time.
0 commit comments