[Test] Add missing disposal for test root disposables

^KT-64099
This commit is contained in:
Marco Pennekamp
2023-12-05 20:55:17 +01:00
committed by Space Team
parent 32fe29b8cc
commit 3497809ebd
5 changed files with 52 additions and 8 deletions
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.incremental
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.vfs.StandardFileSystems
import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.openapi.vfs.local.CoreLocalFileSystem
@@ -81,12 +82,17 @@ abstract class AbstractInvalidationTest(
}
private val zipAccessor = ZipFileSystemCacheableAccessor(2)
private val rootDisposable = TestDisposable("${AbstractInvalidationTest::class.simpleName}.rootDisposable")
protected val environment =
KotlinCoreEnvironment.createForParallelTests(
TestDisposable("${AbstractInvalidationTest::class.simpleName}.rootDisposable"),
CompilerConfiguration(),
EnvironmentConfigFiles.JS_CONFIG_FILES,
)
KotlinCoreEnvironment.createForParallelTests(rootDisposable, CompilerConfiguration(), EnvironmentConfigFiles.JS_CONFIG_FILES)
@AfterEach
protected fun disposeEnvironment() {
// The test is run with `Lifecycle.PER_METHOD` (as it's the default), so the disposable needs to be disposed after each test.
Disposer.dispose(rootDisposable)
}
@AfterEach
protected fun clearZipAccessor() {