tempfile
and tempdir
should fail test when deletion fails
#2351
Labels
enhancement ✨
Suggestions for adding new features or improving existing ones.
framework 🏗️
Pertains to the core structure and components of the Kotest framework.
Milestone
Please describe the feature you'd like to see including any solutions in mind if you have any
Currently
tempfile
andtempdir
use thejava.io.File
methods which merely return aboolean
, and kotest does not check the result whether the file or directory was actually deleted.Expected
Kotest should (by default?) detect when a temporary file or directory could not be deleted and cause a test failure with a descriptive message stating which files could not be deleted (ideally also first attempting to delete all and accumulating exceptions).
This allows test authors to detect when the tested application does not properly close resources, and avoids temporary files from accumulating.
Ideally this would use
java.nio.file.Files
methods to give more insight to the user why deletion failed.For reference, JUnit 5 causes a test failure when deletion fails, see
TempDirectory.java
.The text was updated successfully, but these errors were encountered: