[Gradle] workaround to fix failing checkNodeJsSetup on Windows

^KT-73795
diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/JsSetupConfigurationCacheIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/JsSetupConfigurationCacheIT.kt
index a5165bd..8320427 100644
--- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/JsSetupConfigurationCacheIT.kt
+++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/JsSetupConfigurationCacheIT.kt
@@ -8,8 +8,11 @@
 import org.gradle.util.GradleVersion
 import org.jetbrains.kotlin.gradle.testbase.*
 import org.jetbrains.kotlin.gradle.testbase.BuildOptions.ConfigurationCacheProblems
+import org.junit.jupiter.api.AfterEach
 import org.junit.jupiter.api.DisplayName
 import org.junit.jupiter.api.condition.OS
+import java.nio.file.Files
+import kotlin.io.path.isDirectory
 
 // This test is a JS test
 // but, as it is the only one to required to run on MacOS
@@ -25,6 +28,34 @@
             configurationCacheProblems = ConfigurationCacheProblems.FAIL
         )
 
+    /**
+     * Cleans up symbolic links or shortcuts within the working directory after each test execution.
+     *
+     * This method is specifically designed for Windows operating systems. It traverses the
+     * working directory, collects any symbolic links or shortcuts that are directories but not
+     * actual directories, and deletes them. The operation ensures that resources are cleaned up
+     * properly and avoids any potential issues with stale shortcuts or symbolic links.
+     *
+     * Utilizes the Files.walk method to stream through the directory structure and ensure efficient
+     * resource usage with automatic stream closure upon completion of operations.
+     *
+     * FIXME: Find a real cause and remove this workaround
+     * KT-73795 Fix failing checkNodeJsSetup test on Windows
+     *
+     */
+    @AfterEach
+    fun cleanup() {
+        if (OS.WINDOWS.isCurrentOs) {
+            Files.walk(workingDir).use { stream -> // Automatically closes the stream
+                val links = stream
+                    .filter { it != it.toRealPath() && it.isDirectory() } // Check for symbolic links or shortcuts
+                    .toList() // Collect into a list to prevent modification of the stream during iteration
+
+                links.forEach { Files.deleteIfExists(it) } // Delete the collected shortcuts or links
+            }
+        }
+    }
+
     // hack to be run on Mac m*
     @DisplayName("Check Node.JS setup on different platforms")
     @GradleTest