@@ -7,6 +7,7 @@ const path = require('path');
77const _getStartAndEndCommands = require ( '../../src/get-start-and-end-commands' ) ;
88const utils = require ( '../../src/utils' ) ;
99const loadSafeBlueprint = require ( '../../src/load-safe-blueprint' ) ;
10+ const loadSafeDefaultBlueprint = require ( '../../src/load-safe-default-blueprint' ) ;
1011
1112const {
1213 getArgs
@@ -23,6 +24,8 @@ const commandName = 'ember';
2324const blueprint = 'test-blueprint' ;
2425const blueprintPath = '/path/to/blueprint' ;
2526const projectPath = path . normalize ( `${ cwd } /${ projectName } ` ) ;
27+ const defaultStartBlueprint = loadSafeDefaultBlueprint ( [ ] , startVersion ) ;
28+ const defaultEndBlueprint = loadSafeDefaultBlueprint ( [ ] , endVersion ) ;
2629
2730describe ( _getStartAndEndCommands , function ( ) {
2831 let sandbox ;
@@ -51,14 +54,8 @@ describe(_getStartAndEndCommands, function() {
5154 function getStartAndEndCommands ( options ) {
5255 return _getStartAndEndCommands ( Object . assign ( {
5356 packageJson : { name : projectName } ,
54- startBlueprint : {
55- name : 'ember-cli' ,
56- version : startVersion
57- } ,
58- endBlueprint : {
59- name : 'ember-cli' ,
60- version : endVersion
61- }
57+ startBlueprint : defaultStartBlueprint ,
58+ endBlueprint : defaultEndBlueprint
6259 } , options ) ) ;
6360 }
6461
@@ -76,17 +73,11 @@ describe(_getStartAndEndCommands, function() {
7673 packageName,
7774 commandName,
7875 startOptions : {
79- blueprint : {
80- name : 'ember-cli' ,
81- version : startVersion
82- } ,
76+ blueprint : defaultStartBlueprint ,
8377 packageRange : startVersion
8478 } ,
8579 endOptions : {
86- blueprint : {
87- name : 'ember-cli' ,
88- version : endVersion
89- } ,
80+ blueprint : defaultEndBlueprint ,
9081 packageRange : endVersion
9182 }
9283 } ) ;
@@ -99,9 +90,7 @@ describe(_getStartAndEndCommands, function() {
9990 packageRoot,
10091 options : {
10192 projectName,
102- blueprint : loadSafeBlueprint ( {
103- name : 'ember-cli'
104- } )
93+ blueprint : loadSafeDefaultBlueprint ( [ 'welcome' ] )
10594 }
10695 } ) ;
10796
@@ -131,10 +120,7 @@ describe(_getStartAndEndCommands, function() {
131120 let createProject = createProjectFromRemote ( {
132121 options : {
133122 projectName,
134- blueprint : loadSafeBlueprint ( {
135- name : 'ember-cli' ,
136- version : packageVersion
137- } )
123+ blueprint : loadSafeDefaultBlueprint ( [ 'welcome' ] , packageVersion )
138124 }
139125 } ) ;
140126
@@ -298,10 +284,7 @@ describe(_getStartAndEndCommands, function() {
298284 packageRange : null
299285 } ,
300286 endOptions : {
301- blueprint : {
302- name : 'ember-cli' ,
303- version : endVersion
304- } ,
287+ blueprint : defaultEndBlueprint ,
305288 packageRange : endVersion
306289 }
307290 } ) ;
@@ -363,11 +346,10 @@ describe(_getStartAndEndCommands, function() {
363346 let createProject = createProjectFromRemote ( {
364347 options : {
365348 projectName,
366- blueprint : loadSafeBlueprint ( {
367- name : 'ember-cli' ,
368- version : packageVersion ,
349+ blueprint : {
350+ ...loadSafeDefaultBlueprint ( [ 'welcome' ] , packageVersion ) ,
369351 path : blueprintPath
370- } )
352+ }
371353 }
372354 } ) ;
373355
@@ -418,12 +400,7 @@ describe(_getStartAndEndCommands, function() {
418400 } ) ;
419401
420402 describe ( 'options' , function ( ) {
421- async function processBlueprint ( blueprint ) {
422- let defaultBlueprint = {
423- name : 'ember-cli' ,
424- ...blueprint
425- } ;
426-
403+ async function processBlueprint ( defaultBlueprint = loadSafeDefaultBlueprint ( ) ) {
427404 let options = getStartAndEndCommands ( {
428405 startBlueprint : defaultBlueprint ,
429406 endBlueprint : defaultBlueprint
@@ -456,7 +433,7 @@ describe(_getStartAndEndCommands, function() {
456433 } ) ;
457434
458435 it ( 'can create an addon' , async function ( ) {
459- let args = await processBlueprint ( { type : 'addon' } ) ;
436+ let args = await processBlueprint ( loadSafeDefaultBlueprint ( [ 'addon' ] ) ) ;
460437
461438 let i = args . indexOf ( '-b' ) ;
462439
@@ -466,13 +443,13 @@ describe(_getStartAndEndCommands, function() {
466443 } ) ;
467444
468445 it ( 'can create an app with the --no-welcome option' , async function ( ) {
469- let args = await processBlueprint ( { options : [ '--no-welcome' ] } ) ;
446+ let args = await processBlueprint ( ) ;
470447
471448 expect ( args ) . to . include ( '--no-welcome' ) ;
472449 } ) ;
473450
474451 it ( 'can create an app without the --no-welcome option' , async function ( ) {
475- let args = await processBlueprint ( ) ;
452+ let args = await processBlueprint ( loadSafeDefaultBlueprint ( [ 'welcome' ] ) ) ;
476453
477454 expect ( args ) . to . not . include ( '--no-welcome' ) ;
478455 } ) ;
@@ -484,7 +461,7 @@ describe(_getStartAndEndCommands, function() {
484461 } ) ;
485462
486463 it ( 'can create an app with the yarn option' , async function ( ) {
487- let args = await processBlueprint ( { options : [ '-- yarn'] } ) ;
464+ let args = await processBlueprint ( loadSafeDefaultBlueprint ( [ ' yarn'] ) ) ;
488465
489466 expect ( args ) . to . include ( '--yarn' ) ;
490467 } ) ;
@@ -494,11 +471,7 @@ describe(_getStartAndEndCommands, function() {
494471 let projectName = 'my-project' ;
495472
496473 it ( 'works for default app' , function ( ) {
497- let blueprint = {
498- name : 'ember-cli' ,
499- type : 'app' ,
500- options : [ ]
501- } ;
474+ let blueprint = loadSafeDefaultBlueprint ( [ 'welcome' ] ) ;
502475
503476 let args = getArgs ( projectName , blueprint ) ;
504477
@@ -514,11 +487,7 @@ describe(_getStartAndEndCommands, function() {
514487 } ) ;
515488
516489 it ( 'works for default addon' , function ( ) {
517- let blueprint = {
518- name : 'ember-cli' ,
519- type : 'addon' ,
520- options : [ ]
521- } ;
490+ let blueprint = loadSafeDefaultBlueprint ( [ 'addon' ] ) ;
522491
523492 let args = getArgs ( projectName , blueprint ) ;
524493
@@ -529,16 +498,16 @@ describe(_getStartAndEndCommands, function() {
529498 '-sb' ,
530499 '-sg' ,
531500 '-b' ,
532- 'addon'
501+ 'addon' ,
502+ '--no-welcome'
533503 ] ) ;
534504 } ) ;
535505
536506 it ( 'works for custom app' , function ( ) {
537- let blueprint = {
507+ let blueprint = loadSafeBlueprint ( {
538508 name : 'my-blueprint' ,
539- path : '/path/to/my-blueprint' ,
540- options : [ ]
541- } ;
509+ path : '/path/to/my-blueprint'
510+ } ) ;
542511
543512 let args = getArgs ( projectName , blueprint ) ;
544513
@@ -555,8 +524,7 @@ describe(_getStartAndEndCommands, function() {
555524
556525 it ( 'handles options' , function ( ) {
557526 let blueprint = {
558- name : 'ember-cli' ,
559- type : 'app' ,
527+ ...loadSafeDefaultBlueprint ( [ 'welcome' ] ) ,
560528 options : [
561529 '--my-option-1' ,
562530 '--my-option-2'
0 commit comments