When I write parameterized tests, I use this style of code:
[1, 2, 3].forEach((value) => {
it(`should work for a value of ${value}.`, () => {
// Do the test.
});
});
This ends up creating and running three tests:
- "should work for a value of 1."
- "should work for a value of 2."
- "should work for a value of 3."
But, if the mocha-no-side-effect-code rule is enabled, this is flagged as an error because the rule treats Array.forEach as having side effects.
This could be ignored using the ignore option with something like "\.forEach\(", but I think this is something the rule should just handle in the first place.