@@ -161,187 +161,25 @@ class ProjectIntegrationTest {
161161describe ( "Project Service Tests" , ( ) => {
162162 describe ( "project service integration tests" , ( ) => {
163163 let defaultTemplatePath : string ;
164- let defaultSpecificVersionTemplatePath : string ;
165- let noAppResourcesTemplatePath : string ;
166- let angularTemplatePath : string ;
167- let typescriptTemplatePath : string ;
168-
169- const noAppResourcesTemplateName = "tns-template-hello-world-ts" ;
170164
171165 before ( async ( ) => {
172166 const projectIntegrationTest = new ProjectIntegrationTest ( ) ;
173167
174168 defaultTemplatePath = await prepareTestingPath ( projectIntegrationTest . testInjector , constants . RESERVED_TEMPLATE_NAMES [ "default" ] , constants . RESERVED_TEMPLATE_NAMES [ "default" ] ) ;
175- defaultSpecificVersionTemplatePath = await prepareTestingPath ( projectIntegrationTest . testInjector , constants . RESERVED_TEMPLATE_NAMES [ "default" ] , constants . RESERVED_TEMPLATE_NAMES [ "default" ] , { version : "1.4.0" , dependencyType : "save" } ) ;
176- angularTemplatePath = await prepareTestingPath ( projectIntegrationTest . testInjector , constants . RESERVED_TEMPLATE_NAMES [ "angular" ] , constants . RESERVED_TEMPLATE_NAMES [ "angular" ] ) ;
177- typescriptTemplatePath = await prepareTestingPath ( projectIntegrationTest . testInjector , constants . RESERVED_TEMPLATE_NAMES [ "typescript" ] , constants . RESERVED_TEMPLATE_NAMES [ "typescript" ] ) ;
178- noAppResourcesTemplatePath = await prepareTestingPath ( projectIntegrationTest . testInjector , noAppResourcesTemplateName , noAppResourcesTemplateName , { dependencyType : "save" , version : "2.0.0" } ) ;
179- } ) ;
180-
181- it ( "creates valid project from default template" , async ( ) => {
182- const projectIntegrationTest = new ProjectIntegrationTest ( ) ;
183- const tempFolder = temp . mkdirSync ( "project" ) ;
184- const projectName = "myapp" ;
185-
186- await projectIntegrationTest . createProject ( { projectName : projectName , pathToProject : tempFolder } ) ;
187- await projectIntegrationTest . assertProject ( tempFolder , projectName , "org.nativescript.myapp" , defaultTemplatePath ) ;
188- } ) ;
189-
190- it ( "creates valid project from default template when --template default is specified" , async ( ) => {
191- const projectIntegrationTest = new ProjectIntegrationTest ( ) ;
192- const tempFolder = temp . mkdirSync ( "project" ) ;
193- const projectName = "myapp" ;
194-
195- await projectIntegrationTest . createProject ( { projectName : projectName , template : "default" , pathToProject : tempFolder } ) ;
196- await projectIntegrationTest . assertProject ( tempFolder , projectName , "org.nativescript.myapp" , defaultTemplatePath ) ;
197- } ) ;
198-
199- it ( "creates valid project from default template when --template default@version is specified" , async ( ) => {
200- const projectIntegrationTest = new ProjectIntegrationTest ( ) ;
201- const tempFolder = temp . mkdirSync ( "project" ) ;
202- const projectName = "myapp" ;
203-
204- await projectIntegrationTest . createProject ( { projectName : projectName , template : "default@1.4.0" , pathToProject : tempFolder } ) ;
205- await projectIntegrationTest . assertProject ( tempFolder , projectName , "org.nativescript.myapp" , defaultSpecificVersionTemplatePath ) ;
206- } ) ;
207-
208- it ( "creates valid project from a template without App_Resources" , async ( ) => {
209- const projectIntegrationTest = new ProjectIntegrationTest ( ) ;
210- const tempFolder = temp . mkdirSync ( "project" ) ;
211- const projectName = "myapp" ;
212-
213- await projectIntegrationTest . createProject ( { projectName : projectName , template : noAppResourcesTemplateName + "@2.0.0" , pathToProject : tempFolder } ) ;
214- await projectIntegrationTest . assertProject ( tempFolder , projectName , "org.nativescript.myapp" , noAppResourcesTemplatePath ) ;
215- } ) ;
216-
217- it ( "creates valid project from typescript template" , async ( ) => {
218- const projectIntegrationTest = new ProjectIntegrationTest ( ) ;
219- const tempFolder = temp . mkdirSync ( "projectTypescript" ) ;
220- const projectName = "myapp" ;
221-
222- await projectIntegrationTest . createProject ( { projectName : projectName , template : "typescript" , pathToProject : tempFolder } ) ;
223-
224- await projectIntegrationTest . assertProject ( tempFolder , projectName , "org.nativescript.myapp" , typescriptTemplatePath ) ;
225- } ) ;
226-
227- it ( "creates valid project from tsc template" , async ( ) => {
228- const projectIntegrationTest = new ProjectIntegrationTest ( ) ;
229- const tempFolder = temp . mkdirSync ( "projectTsc" ) ;
230- const projectName = "myapp" ;
231-
232- await projectIntegrationTest . createProject ( { projectName : projectName , template : "tsc" , pathToProject : tempFolder } ) ;
233- await projectIntegrationTest . assertProject ( tempFolder , projectName , "org.nativescript.myapp" , typescriptTemplatePath ) ;
234- } ) ;
235-
236- it ( "creates valid project from angular template" , async ( ) => {
237- const projectIntegrationTest = new ProjectIntegrationTest ( ) ;
238- const tempFolder = temp . mkdirSync ( "projectAngular" ) ;
239- const projectName = "myapp" ;
240-
241- await projectIntegrationTest . createProject ( { projectName : projectName , template : "angular" , pathToProject : tempFolder } ) ;
242-
243- await projectIntegrationTest . assertProject ( tempFolder , projectName , "org.nativescript.myapp" , angularTemplatePath ) ;
244- } ) ;
245-
246- it ( "creates valid project from ng template" , async ( ) => {
247- const projectIntegrationTest = new ProjectIntegrationTest ( ) ;
248- const tempFolder = temp . mkdirSync ( "projectNg" ) ;
249- const projectName = "myapp" ;
250-
251- await projectIntegrationTest . createProject ( { projectName : projectName , template : "ng" , pathToProject : tempFolder } ) ;
252-
253- await projectIntegrationTest . assertProject ( tempFolder , projectName , "org.nativescript.myapp" , angularTemplatePath ) ;
254- } ) ;
255-
256- it ( "creates valid project from local directory template" , async ( ) => {
257- const projectIntegrationTest = new ProjectIntegrationTest ( ) ;
258- const tempFolder = temp . mkdirSync ( "projectLocalDir" ) ;
259- const projectName = "myapp" ;
260- const options = projectIntegrationTest . testInjector . resolve ( "options" ) ;
261-
262- options . path = tempFolder ;
263- const tempDir = temp . mkdirSync ( "template" ) ;
264- const fs : IFileSystem = projectIntegrationTest . testInjector . resolve ( "fs" ) ;
265- fs . writeJson ( path . join ( tempDir , "package.json" ) , {
266- name : "myCustomTemplate" ,
267- version : "1.0.0" ,
268- dependencies : {
269- "lodash" : "3.10.1"
270- } ,
271- devDependencies : {
272- "minimist" : "1.2.0"
273- } ,
274- "description" : "dummy" ,
275- "license" : "MIT" ,
276- "readme" : "dummy" ,
277- "repository" : "dummy"
278- } ) ;
279-
280- fs . createDirectory ( path . join ( tempDir , "App_Resources" , "Android" ) ) ; //copy App_Resources from somewhere
281- fs . createDirectory ( path . join ( tempDir , "App_Resources" , "iOS" ) ) ;
282- // `npm i <path-to-local-dir>` does not copy empty dirs, so the package installed in node_modules will not have App_Resources/Android and App_Resources/iOS dir.
283- fs . writeFile ( path . join ( tempDir , "App_Resources" , "Android" , "some-resource" ) , null ) ;
284- fs . writeFile ( path . join ( tempDir , "App_Resources" , "iOS" , "some-resource" ) , null ) ;
285-
286- await projectIntegrationTest . createProject ( { projectName : projectName , template : tempDir , pathToProject : tempFolder } ) ;
287- await projectIntegrationTest . assertProject ( tempFolder , projectName , "org.nativescript.myapp" , tempDir ) ;
288- } ) ;
289-
290- it ( "creates valid project from tarball" , async ( ) => {
291- const projectIntegrationTest = new ProjectIntegrationTest ( ) ;
292- const tempFolder = temp . mkdirSync ( "projectLocalDir" ) ;
293- const projectName = "myapp" ;
294- const template = "https://github.com/NativeScript/template-hello-world/tarball/master" ;
295-
296- await projectIntegrationTest . createProject ( {
297- projectName : projectName ,
298- template,
299- pathToProject : tempFolder
300- } ) ;
301-
302- const projectSourceDirectory = await prepareTestingPath ( projectIntegrationTest . testInjector , template , constants . RESERVED_TEMPLATE_NAMES [ "default" ] ) ;
303- await projectIntegrationTest . assertProject ( tempFolder , projectName , "org.nativescript.myapp" , projectSourceDirectory ) ;
304- } ) ;
305-
306- it ( "creates valid project from git url" , async ( ) => {
307- const projectIntegrationTest = new ProjectIntegrationTest ( ) ;
308- const tempFolder = temp . mkdirSync ( "projectLocalDir" ) ;
309- const projectName = "myapp" ;
310- const template = "https://github.com/NativeScript/template-hello-world.git" ;
311-
312- await projectIntegrationTest . createProject ( {
313- projectName : projectName ,
314- template,
315- pathToProject : tempFolder
316- } ) ;
317-
318- const projectSourceDirectory = await prepareTestingPath ( projectIntegrationTest . testInjector , template , constants . RESERVED_TEMPLATE_NAMES [ "default" ] ) ;
319- await projectIntegrationTest . assertProject ( tempFolder , projectName , "org.nativescript.myapp" , projectSourceDirectory ) ;
320- } ) ;
321-
322- it ( "creates valid project with specified id from default template" , async ( ) => {
323- const projectIntegrationTest = new ProjectIntegrationTest ( ) ;
324- const tempFolder = temp . mkdirSync ( "project1" ) ;
325- const projectName = "myapp" ;
326-
327- await projectIntegrationTest . createProject ( { projectName : projectName , pathToProject : tempFolder , appId : "my.special.id" } ) ;
328- await projectIntegrationTest . assertProject ( tempFolder , projectName , "my.special.id" , defaultTemplatePath ) ;
329169 } ) ;
330170
331171 describe ( "project name validation tests" , ( ) => {
332172 const validProjectName = "valid" ;
333173 const invalidProjectName = "1invalid" ;
334174 let projectIntegrationTest : ProjectIntegrationTest ;
335175 let tempFolder : string ;
336- let options : IOptions ;
337176 let prompter : IPrompter ;
338177
339178 beforeEach ( ( ) => {
340179 hasPromptedForString = false ;
341180 helpers . isInteractive = ( ) => true ;
342181 projectIntegrationTest = new ProjectIntegrationTest ( ) ;
343182 tempFolder = temp . mkdirSync ( "project" ) ;
344- options = projectIntegrationTest . testInjector . resolve ( "options" ) ;
345183 prompter = projectIntegrationTest . testInjector . resolve ( "prompter" ) ;
346184 } ) ;
347185
0 commit comments