-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
I'm proposing two breaking changes, that would aim users to have a better test suite (or at least better documented in a way)
Making the title of a test mandatory
I can barely see why there should not be one. I can only imagine the case where the file only has one test in a file whose name is self-explanatory, but even then, an additional title can't hurt. In all other cases (like having multiple tests without a title), you're having "undocumented" tests, which is not great for your test suite. I see having a mandatory title as a feature rather than an inconvenience. (And if we do, we should probably forbid ""
as the test title).
Having two tests with the same title should fail the tests
- having two tests in a file (or group, in the future) share the same title should fail the tests
- (should we implement groups) having two groups in a file or inside another group share the same title should fail the tests
The reasoning is like this: If I have two tests with the same title, I have probably copy-pasted a test without updating the title, or I have two tests that do not describe very well what they are testing. Enforcing different titles for every test should help have more descriptive tests. We already attempt to enforce that in the AVA ESLint plugin, but it would be done more effectively in the runner.
Should the title be kept optional, we would probably ignore tests without title, or accept at most one.
(I made the same proposal in an other test runner, and thought I'd propose it here too. Titles in that test runner are mandatory too by the way)
Let me know what you think :)