Skip to content

Commit c403d96

Browse files
committed
Revert "GRAILS-5579 - don't execute a test phase unless at least one of it's types have a present source dir"
This reverts commit a247369e0f83bae939e36e17b2a72712895ab727 (was meant for 1.2.x branch).
1 parent d0be4c2 commit c403d96

File tree

1 file changed

+25
-30
lines changed

1 file changed

+25
-30
lines changed

scripts/_GrailsTest.groovy

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -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 ? "\nTests FAILED" : "\nTests 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

Comments
 (0)