This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
New mocha-no-side-effect-code
rule
#85
Labels
Microsoft Internal
Issues related to closed source Microsoft code.
Milestone
tl;dr: This rule to ensure no assignment statements or function calls in tests outside mocha
before()
,after()
,beforeEach()
,afterEach()
andit()
scopes.Reason: You cannot predict (or you are not supposed to know as a developer writing tests) when code containing assignment statements or function calls in tests outside mocha
before()
,after()
,beforeEach()
,afterEach()
andit()
is indeed executed (this is up to requirejs, order of requires for the tests files and also up to Mocha for execution of describe().This leads to some tests having side effects to some other tests.
With this rule, only variable or function declarations would be allowed outside the scopes listed above.
(Also
import
s would be allowed)The text was updated successfully, but these errors were encountered: