@@ -168,38 +168,23 @@ target(allTests: "Runs the project's tests.") {
168168 filteredPhases. each { phase , types ->
169169 currentTestPhaseName = phase
170170
171- def dirs = [:]
172- types. each {
173- def relativeSourcePath = it. relativeSourcePath
174- if (relativeSourcePath) {
175- def source = new File (testSourceDir, relativeSourcePath)
176- if (source. exists()) {
177- dirs[it] = [source : source, classes : new File (grailsSettings. testClassesDir, relativeSourcePath)]
178- }
179- }
180- }
171+ // Add a blank line before the start of this phase so that it
172+ // is easier to distinguish
173+ println ()
181174
182- if (dirs) {
183- // Add a blank line before the start of this phase so that it
184- // is easier to distinguish
185- println ()
175+ event(" StatusUpdate" , [" Starting $phase test phase" ])
176+ event(" TestPhaseStart" , [phase])
186177
187- event(" StatusUpdate" , [" Starting $phase test phase" ])
188- event(" TestPhaseStart" , [phase])
178+ " ${ phase} TestPhasePreparation" ()
189179
190- " ${ phase} TestPhasePreparation" ()
191-
192- // Now run all the tests registered for this phase.
193- types. each {
194- processTests(it, dirs[it]. source, dirs[it]. classes)
195- }
180+ // Now run all the tests registered for this phase.
181+ types. each(processTests)
196182
197- // Perform any clean up required.
198- this . " ${ phase} TestPhaseCleanUp" ()
183+ // Perform any clean up required.
184+ this . " ${ phase} TestPhaseCleanUp" ()
199185
200- event(" TestPhaseEnd" , [phase])
201- currentTestPhaseName = null
202- }
186+ event(" TestPhaseEnd" , [phase])
187+ currentTestPhaseName = null
203188 }
204189 } finally {
205190 String msg = testsFailed ? " \n Tests FAILED" : " \n Tests PASSED"
@@ -220,10 +205,20 @@ target(allTests: "Runs the project's tests.") {
220205 * @param type The type of the tests to compile (not the test phase!)
221206 * For example, "unit", "jsunit", "webtest", etc.
222207 */
223- processTests = { GrailsTestType type , File sourceDir , File classesDir ->
208+ processTests = { GrailsTestType type ->
224209 currentTestTypeName = type. name
225- compileTests(type, sourceDir, classesDir)
226- runTests(type, classesDir)
210+
211+ def relativePathToSource = type. relativeSourcePath
212+ def dest = null
213+ if (relativePathToSource) {
214+ def source = new File (" ${ testSourceDir} " , relativePathToSource)
215+ if (! source. exists()) return // no source, no point continuing
216+
217+ dest = new File (grailsSettings. testClassesDir, relativePathToSource)
218+ compileTests(type, source, dest)
219+ }
220+
221+ runTests(type, dest)
227222 currentTestTypeName = null
228223}
229224
0 commit comments