Lukasz Kalnik
01/06/2025, 2:53 PMisolationMode = InstancePerLeaf
. My class under test has a dependency, which is an object
keeping some state (I don't want to mock it, as it's very simple). I was expecting the object to be torn down between tests, and constructed anew for every subsequent tests (so that the state isn't retained between tests). Turns out it isn't so, the object with its state is retained and influences subsequent tests.sam
01/06/2025, 3:21 PMsam
01/06/2025, 3:21 PMLukasz Kalnik
01/06/2025, 3:33 PMLukasz Kalnik
01/06/2025, 3:34 PMLukasz Kalnik
01/06/2025, 3:34 PMLukasz Kalnik
01/06/2025, 3:37 PMFreeSpec
with some level of nesting (2-3 nested levels), but many tests are completely independent.Lukasz Kalnik
01/06/2025, 3:37 PMLukasz Kalnik
01/06/2025, 3:38 PMAlex Kuznetsov
01/06/2025, 4:24 PMInstancePerTest
with simple StringSpec
which works for me. I concur - "test class is recreated from scratch for every test." is very important for lots of folksLukasz Kalnik
01/06/2025, 4:26 PMLukasz Kalnik
01/06/2025, 4:29 PMInstancePerTest
though seems weird to me.
It runs the container tests (in specs that use them) separately as well, additionally to running them with the leaf test.
So the container tests are effectively run multiple times. I'm not sure where this could be useful.Alex Kuznetsov
01/06/2025, 4:32 PM