Skip to main content
Version: 5.x.x

Testing Isolation

Isolation is extremely important for making both deterministic and valid tests. Due to the approach to architecture where the client is a global module, we need to bring some of our attention to it.


The client.clear() request allows us to isolate our test cases within one file. It will reinitialize the subsystems of our client.

Node cache cleanup

To properly isolate our tests, we need to be sure that the node instance require.cache will be reset. This way our global client module will be restarted and we will have the environment prepared.


beforeEach(() => {
// We need to reset modules cache as client is globally exported module
// This way it will not get mixed-up with other test cases running in parallel
// Clean the environment to make sure it's isolated