@@ -10,7 +10,7 @@ import {
1010 IProjectDataService ,
1111 IProjectService ,
1212} from "../lib/definitions/project" ;
13- import { IProjectNameService } from "../lib/declarations" ;
13+ import { IOptions , IProjectNameService } from "../lib/declarations" ;
1414import { IInjector } from "../lib/common/definitions/yok" ;
1515import { IDictionary , IFileSystem } from "../lib/common/declarations" ;
1616import { ProjectConfigService } from "../lib/services/project-config-service" ;
@@ -118,6 +118,26 @@ describe("projectService", () => {
118118 projectName,
119119 projectDir,
120120 } ) ;
121+ } ) ;
122+
123+ it ( "creates a git repo" , async ( ) => {
124+ const projectName = invalidProjectName ;
125+ const testInjector = getTestInjector ( { projectName } ) ;
126+ const options = testInjector . resolve < IOptions > ( "options" ) ;
127+ const projectService = testInjector . resolve < IProjectService > (
128+ ProjectServiceLib . ProjectService
129+ ) ;
130+ const projectDir = path . join ( dirToCreateProject , projectName ) ;
131+
132+ // force creation to skip git repo check...
133+ options . force = true ;
134+
135+ await projectService . createProject ( {
136+ projectName : projectName ,
137+ pathToProject : dirToCreateProject ,
138+ force : true ,
139+ template : constants . RESERVED_TEMPLATE_NAMES [ "default" ] ,
140+ } ) ;
121141
122142 assert . deepEqual (
123143 testInjector . resolve ( "childProcess" ) . _getExecutedCommands ( ) ,
@@ -129,6 +149,30 @@ describe("projectService", () => {
129149 ) ;
130150 } ) ;
131151
152+ it ( "does not create a git repo with --no-git" , async ( ) => {
153+ const projectName = invalidProjectName ;
154+ const testInjector = getTestInjector ( { projectName } ) ;
155+ const options = testInjector . resolve < IOptions > ( "options" ) ;
156+ const projectService = testInjector . resolve < IProjectService > (
157+ ProjectServiceLib . ProjectService
158+ ) ;
159+
160+ // simulate --no-git
161+ options . git = false ;
162+
163+ await projectService . createProject ( {
164+ projectName : projectName ,
165+ pathToProject : dirToCreateProject ,
166+ force : true ,
167+ template : constants . RESERVED_TEMPLATE_NAMES [ "default" ] ,
168+ } ) ;
169+
170+ assert . deepEqual (
171+ testInjector . resolve ( "childProcess" ) . _getExecutedCommands ( ) ,
172+ [ ]
173+ ) ;
174+ } ) ;
175+
132176 it ( "fails when invalid name is passed when projectNameService fails" , async ( ) => {
133177 const projectName = invalidProjectName ;
134178 const testInjector = getTestInjector ( { projectName } ) ;
0 commit comments