before, beforeEach, afterEach and after hooks of other tests in a file gets called whenever a singular test is intended to be run.
See example
When you run
node --test --test-name-pattern "should add two numbers " on this test file, it is not meant to call the before hooks of the
second and third describe in the code below.
before
,beforeEach
,afterEach
andafter
hooks of other tests in a file gets called whenever a singular test is intended to be run.See example
When you run
node --test --test-name-pattern "should add two numbers "
on this test file, it is not meant to call the before hooks of thesecond and third describe in the code below.
see the codesanbox here