Why is this an issue?

Test files in JavaScript and TypeScript are meant to contain test cases. These test cases are used to verify the functionality of your code and ensure that it behaves as expected. If a test file doesn’t contain any test cases, it’s not serving its purpose.

A test file without test cases might indicate:

This rule flags any file that has .test or .spec as part of its suffix but does not contain any test cases defined using the different forms of the it and test functions from Jasmine, Jest, Mocha, or Node.js testing API.

How to fix it

Add test cases to the file or delete it if it isn’t needed anymore.

Code examples

Noncompliant code example

// eval.test.js

/* no test cases */

Compliant solution

// eval.test.js

it('1 + 2 should give 3', () => {
    expect(1 + 2).toBe(3);
});

Resources

Documentation