What is the order of RSpec hooks in the Queue Mode?
Since version 7.0, Knapsack Pro invokes RSpec hooks in the order you would expect:
before :suite before :context before :example after :example after :context after :suite
Learn more about Knapsack Pro hooks in the docs.
For Knapsack Pro versions older than 7.0, keep reading.
By default, RSpec runs before
and after
hooks, and they are called in the following order:
before :suite before :context before :example after :example after :context after :suite
In Queue Mode the knapsack_pro gem fetches a batch of test files from the Queue API and repeats that until no more tests are returned from the Queue API. For each batch of tests fetched, the above hooks are called. This means the before(:suite)
and after(:suite)
can be called multiple times for a given CI node.