`no-identical-title` maybe could be ignored for nested `describe` blocks...?
See original GitHub issueMy scenario is that the linter is whining about no-identical-title
s for nested describes where that nested title is actually what i want.
Imagine this:
describe("my component", () => {
describe("west facing", () = {
describe("when the sun is up", () => {
it("sees the sun", () => {});
})
describe("when the sun is down", () => {
it("sees the moon", () => {});
});
});
describe("east facing", () = {
describe("when the sun is up", () => {
it("does not see the sun", () => {});
})
describe("when the sun is down", () => {
it("sees whatever", () => {});
});
});
});
In this case… the linter doesn’t like when the sun is up
and when the sun is down
because they are the same, but as nested describes, they seem like a valid use case.
What do you think of that? could there be a rule that looks at the full “nested” title to determine it’s allowed “uniqueness”?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Why can't nested describe() blocks see vars defined in outer ...
The below code works fine. I've set up a variable in my root describe() block that is accessible within my sub- describe() s'...
Read more >You can't nest describe blocks in ExUnit
I write JavaScript in my day job and nesting describe blocks in my tests is such common practise, that I hardly even think...
Read more >@jest/expect-utils | Yarn - Package Manager
This module exports some utils for the expect function used in Jest. You probably don't want to use this package directly. E.g. if...
Read more >Codiga Analysis JavaScript Rules
The Codiga Static Analysis engine checks JavaScript code and supports many popular libraries. If you are using React, NextJS, Vue or Angular: the...
Read more >Angular Testing Part 2: Jasmine Syntax - Dave Ceddia
If you haven't done much or any testing up til now, Jasmine's syntax can look a little strange. There's nested describe , it...
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
That definitely makes sense! We should try to match against full names (so
my component > west facing > when the sun is up > sees the sun
) and not againstdescribe
s andit
s in isolation.Not sure how hard that is, but PR welcome!
Fine with me!