If you define your project in such a way you have more than one layer of modules, whenever you run tests for a specific class it will start a gradle task on the topmost parent module in the hierarchy.
For instance, imagine we have the following project structure:
- myProject root
- model
- domain
- presentation
- feature1
- feature2
- featureN
Running any contextual testing action for a feature class will trigger a gradle task for the whole presentation module.
That can be problematic for projects with dozen of other sibling modules.
Executing tasks: [verifyPaparazziDebug, --tests, com.company.presentation.feature1.myClass] in project /Users/alex/git/myProject/presentation
The problem seems to be caused by the Path.modulePath extension, which probably assumes there will be only one layer of modules.
|
internal fun Project.modulePath(file: VirtualFile): String? { |
|
return modules.asSequence().map { it.getModuleDir() }.firstOrNull { file.path.startsWith(it) } |
|
?: basePath?.let { projectPath -> |
|
val relativePath = FileUtil.getRelativePath(projectPath, file.path, File.separatorChar) |
|
val moduleName = relativePath?.split(File.separator)?.firstOrNull() |
|
if (moduleName != null) projectPath + File.separator + moduleName else null |
|
} |
|
} |
If you define your project in such a way you have more than one layer of modules, whenever you run tests for a specific class it will start a gradle task on the topmost parent module in the hierarchy.
For instance, imagine we have the following project structure:
Running any contextual testing action for a feature class will trigger a gradle task for the whole presentation module.
That can be problematic for projects with dozen of other sibling modules.
The problem seems to be caused by the
Path.modulePathextension, which probably assumes there will be only one layer of modules.paparazzi-plugin/src/main/kotlin/com/getyourguide/paparazzi/Utils.kt
Lines 63 to 70 in c062d36