> Is it supposed to be possible for `beforeSpec...
# kotest
x
Is it supposed to be possible for
beforeSpec
to get called more than once on a single
Spec
?
I'm asking because with 5.7.1 and 5.7.2 we're seeing
beforeSpec
getting called twice on a single spec, but only sometimes. (We weren't seeing this behavior with 5.6.2 or earlier.) How many times it gets run seems nondeterministic: on some machines it only calls it once, on others it'll call it twice. Other things can affect this too, like if all specs are being run, or only a subset, or even if the repo is clean or had previously run the tests. Given the nondeterminism, it feels like a race condition: like something is not realizing that another coroutine already ran (or started to run)
beforeSpec
, and so it runs it again. The docs seem to imply that
beforeSpec
is only supposed to be called once per spec instance, though I can't find a place where they say this explicitly. So before I file a bug report about this, I'd like to confirm: is
beforeSpec
supposed to only get called once per spec instance?
o
I’d say it is safe to assume that beforeSpec is supposed to be called once per spec. The behavior you’re seeing is most likely a bug.
x
Ok, thanks. I've filed an issue: https://github.com/kotest/kotest/issues/3684