Skip to content
Sarj Code Standards

no-test-comments

Express test behavior through names, fixtures and assertions instead of prose comments.

Why

Test comments duplicate or obscure behavior that executable setup and assertions should communicate.

Fix

Move the explanation into a descriptive test or helper name, then remove the comment. Review and migrate legal notices and tool directives before removing frontend comments; preserve those contracts in non-frontend tests.

Examples

Before — flagged Put behavior in the test name
src/request.test.ts
expect(result.status).toBe(409); // Confirm the rejected request
After — preferred The assertion expresses the behavior
src/request.test.ts
expect(result.status).toBe(409);
Autofix output
src/request.test.ts
expect(result.status).toBe(409);

Options

{
"additionalProperties": false,
"properties": {
"allFiles": {
"description": "Check every eligible test file without requiring frontend framework ownership.",
"type": "boolean"
}
},
"type": "object"
}