All Jest Describes Run First
When writing a Jest test, the setup code inside any top-level describe
function gets run before any scenario. So, if you setup a world in one describe
, and a competing world in another, the last one that is run wins.
This even applies when you've marked a describe as 'skip' via xdescribe
. The code inside that setup will still be run.
This is a first pass at a TIL, because I'm not sure the behavior I'm seeing is expected, and if so, why it is expected. It certainly surprised me 😳. I think one solution is to limit your tests to one top-level describe
which has the important benefit of being more readable, too.