Skip to content

test-phase-label-comment

Tests must not use bare Arrange, Act, Assert, Given, When, or Then phase comments.

Why

Phase labels narrate test structure without explaining behavior and often hide unclear names or oversized tests.

Fix

Delete the label; if the phases remain hard to follow, extract a named helper or split the test.

Examples

Before — flagged Bare phase label is removed
widget.test.ts
// Arrange
const widget = makeWidget();
After — preferred Behavioral consequence is retained
widget.test.ts
// Then the retry loop would spin forever.
expect(run()).toBe(true);
Autofix output
widget.test.ts
const widget = makeWidget();