@@ -135,14 +135,18 @@ class TestInitCommand implements ICommand {
135
135
) ;
136
136
137
137
const testsDir = path . join ( this . $projectData . appDirectoryPath , "tests" ) ;
138
- const relativeTestsDir = path . relative (
138
+ const projectTestsDir = path . relative (
139
139
this . $projectData . projectDir ,
140
140
testsDir
141
141
) ;
142
+ const relativeTestsDir = path . relative (
143
+ this . $projectData . appDirectoryPath ,
144
+ testsDir
145
+ ) ;
142
146
let shouldCreateSampleTests = true ;
143
147
if ( this . $fs . exists ( testsDir ) ) {
144
148
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.`
146
150
) ;
147
151
shouldCreateSampleTests = false ;
148
152
}
@@ -157,7 +161,11 @@ class TestInitCommand implements ICommand {
157
161
relativeTestsDir
158
162
) } /**/*${ projectFilesExtension } '`;
159
163
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
+ } ) ;
161
169
162
170
this . $fs . writeFile ( path . join ( projectDir , "karma.conf.js" ) , karmaConf ) ;
163
171
@@ -171,11 +179,11 @@ class TestInitCommand implements ICommand {
171
179
path . join ( testsDir , `example${ projectFilesExtension } ` )
172
180
) ;
173
181
this . $logger . info (
174
- `\nExample test file created in ${ relativeTestsDir } ` . yellow
182
+ `\nExample test file created in ${ projectTestsDir } ` . yellow
175
183
) ;
176
184
} else {
177
185
this . $logger . info (
178
- `\nPlace your test files under ${ relativeTestsDir } ` . yellow
186
+ `\nPlace your test files under ${ projectTestsDir } ` . yellow
179
187
) ;
180
188
}
181
189
0 commit comments