suggestion: prefer `test` or `it`
See original GitHub issueSuggest using test
or it
(always-test-or-it)
For consistency in code, always use test
or always use it
.
Rule details
When test
is preferred, this rule triggers a warning for any instances of it
.
When it
is preferred, this rule triggers a warning for any instances of test
.
This rule is not set by default.
Default configuration
The following pattern is considered warning:
it('example 1', () => {
expect(files).toHaveLength(1);
});
test('example 2', () => {
expect(files).toHaveLength(1);
});
The following pattern is not warning when test
is set:
test('example 1', () => {
expect(files).toHaveLength(1);
});
test('example 2', () => {
expect(files).toHaveLength(1);
});
The following pattern is not warning when it
is set:
it('example 1', () => {
expect(files).toHaveLength(1);
});
it('example 2', () => {
expect(files).toHaveLength(1);
});
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
How To Use Suggest & Recommend – English Grammar Lesson
Unlike many verbs, suggest and recommend are not followed by an object + ... recommended that we study this list of vocabulary for...
Read more >How To Use Recommend, Suggest, Advise [2021] - YouTube
In this video, learn how to use Recommend, Suggest, Advise. Is RECOMMEND ME correct? Is SUGGEST ME correct? Is ADVISE ME correct?
Read more >How to use SUGGEST & RECOMMEND - YouTube
Even many advanced English students don't know how to use " suggest " and "recommend" properly. In this video I explain the three...
Read more >Suggest - Grammar - Cambridge Dictionary
We can use the verb suggest with a noun phrase, a that-clause, the -ing form of a verb or a wh-question word (where,...
Read more >Jest Testing like a Pro - Tips and tricks
... I really suggest you reading it and going back to it every time you write a slightly more complex test or assertion,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think 3 options makes sense. Can be an object instead of a single string as well.
{ fn: 'test', withinDescribe: 'it'}
or somethingI think that could be nice.
When using
describe()
, I prefer using onlyit()
.When not using
describe()
, I prefer using onlytest()
.I’ve worked in codebases that have done one or the other, so being able to configure this could help ensure consistency in those codebases.