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:
- An incomplete test suite: Perhaps the developer started writing tests but didn’t finish.
- A mistake: The developer might have accidentally deleted the test cases or moved them to another file.
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.