Skip to content

Commit

Permalink
Improve test utils (#5275)
Browse files Browse the repository at this point in the history
  • Loading branch information
BraisGabin committed Sep 4, 2022
1 parent 9c7a491 commit 6b6d904
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -12,6 +12,7 @@ import org.spekframework.spek2.dsl.Root
import org.spekframework.spek2.lifecycle.CachingMode
import java.io.File
import java.nio.file.Path
import kotlin.script.experimental.jvm.util.classpathFromClassloader

@Deprecated(
"This is specific to Spek and will be removed in a future release. Documentation has been updated to " +
Expand Down Expand Up @@ -48,7 +49,12 @@ internal class KotlinEnvironmentResolver : ParameterResolver {
override fun resolveParameter(parameterContext: ParameterContext, extensionContext: ExtensionContext): Any {
val closeableWrapper = extensionContext.wrapper
?: CloseableWrapper(
createEnvironment(additionalJavaSourceRootPaths = extensionContext.additionalJavaSourcePaths())
createEnvironment(
additionalRootPaths = checkNotNull(
classpathFromClassloader(Thread.currentThread().contextClassLoader)
) { "We should always have a classpath" },
additionalJavaSourceRootPaths = extensionContext.additionalJavaSourcePaths(),
)
).also { extensionContext.wrapper = it }
return closeableWrapper.wrapper.env
}
Expand Down

0 comments on commit 6b6d904

Please sign in to comment.