Skip to content

Commit e193d77

Browse files
committed
Fix tests to use proper task execution instead of exec()
- Replace direct .exec() calls with task action execution - This triggers @TaskAction execute() method which handles: - nuget.exe download if needed - Mono wrapping on macOS/Linux - Proper argument handling and deduplication - Fixes 4 out of 5 failing tests on macOS with Mono - Tests now properly exercise the full task execution lifecycle
1 parent e300c0b commit e193d77

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/test/groovy/com/ullink/NuGetDownloadTest.groovy

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ class NuGetDownloadTest {
210210
nuspecFile = nuspec
211211
}
212212

213-
project.tasks.nugetPack.exec()
213+
// Execute the task properly to trigger @TaskAction execute() method
214+
// This ensures nuget.exe download and Mono wrapping are handled correctly
215+
project.tasks.nugetPack.actions.each { action ->
216+
action.execute(project.tasks.nugetPack)
217+
}
214218
}
215219
}

src/test/groovy/com/ullink/NuGetPluginTest.groovy

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ class NuGetPluginTest {
4949
nuspecFile = nuspec
5050
}
5151

52-
project.tasks.nugetPack.exec()
52+
// Execute the task properly to trigger @TaskAction execute() method
53+
project.tasks.nugetPack.actions.each { action ->
54+
action.execute(project.tasks.nugetPack)
55+
}
5356
assertTrue(project.tasks.nugetPack.packageFile.exists())
5457
}
5558

@@ -78,7 +81,10 @@ class NuGetPluginTest {
7881
packageVersion = "100.200.300"
7982
}
8083

81-
project.tasks.nugetPack.exec()
84+
// Execute the task properly to trigger @TaskAction execute() method
85+
project.tasks.nugetPack.actions.each { action ->
86+
action.execute(project.tasks.nugetPack)
87+
}
8288
def packageFile = project.tasks.nugetPack.packageFile
8389
assertEquals("bar.100.200.300.nupkg", packageFile.name)
8490
assertTrue(packageFile.exists())

0 commit comments

Comments
 (0)