-
Notifications
You must be signed in to change notification settings - Fork 241
Closed
Description
My preferred style is for top-level describe
/it
s to have names starting with a capital letter, and all nested blocks lower case. So then the concatenated test name reads like a sentence starting with a capital letter.
e.g.:
describe('Monkeys', () => {
describe('eat', () => {
it('bananas', () => { /* ... */ } );
});
it('sleep in the daytime', () => { /* ... */ } );
});
it('Elephants are very big', () => { /* ... */ } );
// Monkeys eat bananas
// Monkeys sleep in the daytime
// Elephants are very big
At present this style is not possible to enforce with the lowercase-name
rule.
How about:
- Add
lowercase-name
ignore
options'top-describe'
,'top-it'
,'top-test'
(and'top'
as a shortcut for all three) - Add a new
uppercase-name
rule with the same options.
Alternatively, a new rule called e.g. name-case
could cover all possible permutations, with options something like:
"lower"
"upper"
// Override for different statements
"lower", { "describe": "upper", "it": "upper", "test": "upper" }
"upper", { "describe": "ignore" }
// Override for all top-level statements
"lower", { "top": "upper" }
// Override for specific top-level statements
"lower", { "describe": "upper", "top": { "describe": "lower" } }
Do you feel this would be useful?