Closed zaneduffield closed 2 months ago
Thanks for the report. Fixed in the linked commit and released as 0.7.1.
I added exit_code
but decided against a full deprecation of the exit
methods. I did add a warning to the docs though and moved them to the very bottom.
That was fast! Thanks 😄
In https://github.com/nextest-rs/datatest-stable/issues/20 I discovered that coverage data was not being generated for some of my tests. I came to the conclusion (at https://github.com/nextest-rs/datatest-stable/issues/20#issuecomment-2044050867) that the problem was the use of
std::process::exit
from withinlibtest_mimic
.It seems that on Windows (but not linux), coverage data isn't written to disk when the process is terminated with
std::process::exit
. The documentation on which saysI presume that the profiling data is written to disk in the destructor for some type, and that isn't run when you terminate abruptly with
std::process::terminate
. I have no idea why this only affects Windows.To work around this problem, in
datatest-stable
the maintainer usedlibtest_mimic::Conclusion::has_failed
to return astd::process::ExitCode
from the generatedmain
function (see https://github.com/nextest-rs/datatest-stable/commit/33d4725463e839060c70254b0c879ad5e27a3cfb). WhenExitCode
is returned frommain
, threads are cleaned up and coverage data is generated properly.As discussed in https://github.com/nextest-rs/datatest-stable/issues/20#issuecomment-2044122291
libtest-mimic
may want to deprecatelibtest_mimic::Conclusion::exit
in favour of a method that returns anExitCode
.