You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey there, thanks for your quick work fixing #1068! Unfortunately, I'm still seeing an issue with prefer-snapshot-hint.
With "jest/prefer-snapshot-hint": ["warn", "multi"] set, this works fine:
describe("my cool test",()=>{it("requires hints for a test with multiple snapshots",()=>{expect(1).toMatchSnapshot("a cool hint");expect(2).toMatchSnapshot("another cool hint");});});
This also works fine:
describe("my cool test",()=>{it("doesn't require hints for a test with a single snapshot",()=>{expect(2).toMatchSnapshot();});});
However, this yields a warning:
describe("my cool test",()=>{it("doesn't require hints for a test with a single snapshot",()=>{expect(2).toMatchSnapshot();// ^ Warning: You should provide a hint for this snapshot});it("requires hints for a test with multiple snapshots",()=>{expect(1).toMatchSnapshot("a cool hint");expect(2).toMatchSnapshot("another cool hint");});});
I see in the rule description there's a parenthetical "(meaning it includes nested calls)" -- is this what that means? The behaviour is a bit surprising to me -- I thought "nested calls" meant it would treat the scope as including all functions called from within an it() block, not all it() blocks within a describe() block.
The text was updated successfully, but these errors were encountered:
Yup that's another bug - your thinking on what "nested calls" means is correct - the behaviour shouldn't change just because it gets wrapped in a describe like that.
Hey there, thanks for your quick work fixing #1068! Unfortunately, I'm still seeing an issue with
prefer-snapshot-hint
.With
"jest/prefer-snapshot-hint": ["warn", "multi"]
set, this works fine:This also works fine:
However, this yields a warning:
I see in the rule description there's a parenthetical "(meaning it includes nested calls)" -- is this what that means? The behaviour is a bit surprising to me -- I thought "nested calls" meant it would treat the scope as including all functions called from within an
it()
block, not allit()
blocks within adescribe()
block.The text was updated successfully, but these errors were encountered: