@@ -135,14 +135,18 @@ class TestInitCommand implements ICommand {
135135 ) ;
136136
137137 const testsDir = path . join ( this . $projectData . appDirectoryPath , "tests" ) ;
138- const relativeTestsDir = path . relative (
138+ const projectTestsDir = path . relative (
139139 this . $projectData . projectDir ,
140140 testsDir
141141 ) ;
142+ const relativeTestsDir = path . relative (
143+ this . $projectData . appDirectoryPath ,
144+ testsDir
145+ ) ;
142146 let shouldCreateSampleTests = true ;
143147 if ( this . $fs . exists ( testsDir ) ) {
144148 this . $logger . info (
145- `${ relativeTestsDir } directory already exists, will not create an example test project.`
149+ `${ projectTestsDir } directory already exists, will not create an example test project.`
146150 ) ;
147151 shouldCreateSampleTests = false ;
148152 }
@@ -157,7 +161,11 @@ class TestInitCommand implements ICommand {
157161 relativeTestsDir
158162 ) } /**/*${ projectFilesExtension } '`;
159163 const karmaConfTemplate = this . $resources . readText ( "test/karma.conf.js" ) ;
160- const karmaConf = _ . template ( karmaConfTemplate ) ( { frameworks, testFiles } ) ;
164+ const karmaConf = _ . template ( karmaConfTemplate ) ( {
165+ frameworks,
166+ testFiles,
167+ basePath : this . $projectData . getAppDirectoryRelativePath ( ) ,
168+ } ) ;
161169
162170 this . $fs . writeFile ( path . join ( projectDir , "karma.conf.js" ) , karmaConf ) ;
163171
@@ -171,11 +179,11 @@ class TestInitCommand implements ICommand {
171179 path . join ( testsDir , `example${ projectFilesExtension } ` )
172180 ) ;
173181 this . $logger . info (
174- `\nExample test file created in ${ relativeTestsDir } ` . yellow
182+ `\nExample test file created in ${ projectTestsDir } ` . yellow
175183 ) ;
176184 } else {
177185 this . $logger . info (
178- `\nPlace your test files under ${ relativeTestsDir } ` . yellow
186+ `\nPlace your test files under ${ projectTestsDir } ` . yellow
179187 ) ;
180188 }
181189
0 commit comments