Closed pohly closed 1 month ago
ah. subtle. so the outer HaveField
matcher is being polled and when it successfully fins .Items
it passes the value of that field to ContainElements
which then passes it to the inner HaveField
. when the code deleted the items the out HaveField
matcher failed early and did nto pass nil
in to ContainElements
.
The problem is that HaveField
, the inner HaveField
in particular, memoizes the extractedField
and expectedMatcher
so that it can render failure messages without having to redo the expensive (?) logic of extracting the field. I can remove this optimization, though, and then you won't get this stale and confusing detail in the output.
done. will cut a release soon. i expect this change to be stable and the performance impact to be limited but please let me know if you see anything suspicious!
I am using the following code to ensure that
list.Items[]
has exactly one element and that element has an emptySpec.Devices
:My code under test incorrectly deleted all items (=
list.Items[]
empty). But the failure message then contained information about some previous item: