redline
MediumTests and CIassertions-removed

Assertions removed

Assertions removed. This change removes 3 assertions from the test and adds 0. Check the test still proves what it used to.

This is how the comment reads inline, under the flagged line.

Why it matters

Deleting assertions is the quickest way to make a red test green. Sometimes right, often the bug fix that wasn't.

What to do

Keep the assertion and fix the code, or explain in the PR why the behavior changed.

Examples

Flagged
- expect(total).toBe(42);
+ // flaky, removed
Better
expect(total).toBe(42);

What it catches

It reads the whole change: every file and the lines it removed. Languages: Any file. Scope: Test files only. These cases are the rule's own tests: the first set must be flagged and the second must not.

Research

Assertions deleted, or expected values edited to match bad output. It turns a red test green without fixing the bug.

Turn it off or change it

In a config file for the CLI, or in the API's rules field:

{
  "rules": {
    "disable": [
      "assertions-removed"
    ],
    "severity": {
      "assertions-removed": "low"
    }
  }
}

Read the source or report a false positive.