Skip to content

Implement no explicit wrapper destroy rule

Description

This MR implements #61 (closed) which is a part of removing excessive wrapper.destroy() epic.

Once this rule is implemented, we can add it to gitlab codebase. That would allow us to check that no new unnecessary code is added, and push people working on existing specs to remove the unnecessary calls as well

Possible concerns

Performance considerations

I've run the eslint check containing this rule against gitlab codebase using the following command (thanks @vitallium for the suggestion!):

TIMING=1 yarn eslint **/*_spec.js  

and here's the ouput:

Screenshot_2023-02-21_at_13.05.18

So this particular rule is not in the top-10 contributors to the overall execution time.

Running eslint against a single test file also does not reveal this particular rule impact:

Screenshot_2023-02-21_at_13.10.37

Configurability

I considered adding configuration parameters for this rule for example to set up the name of the execution block (afterEach right now) and/or potential wrapper names parameters. However running the rule as is against gitlab codebase provided a good-enough result in my opinion, as we are pretty consistent with naming (cudos to us!). If you think we can benefit from it, please let me know - I am open to add additional configuration if there's a reason for it.

Merge request reports