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
Sometimes it is nice to give some extra context around what the test is doing, and I find that the story name is not always an ideal place for this. I've taken to just adding comments at the top of my play function, but these don't show up in the test result output of course. It might be nice to have a way to customize what is shown there instead of always just smoke-test or play-test.
Additional context
I'm not really sure how'd you'd accomplish this, short of adding another property onto CSF objects, which does not feel ideal. My only other idea would be to allow a return value from play functions, which you could use to pass before/after hooks, and maybe also a description.
The text was updated successfully, but these errors were encountered:
describe('MyComponent',()=>{it("Story1's story name",()=>{ ... });it("Story2's story name",()=>{ ... });});
This would be consistent with the idea that the story is the combination of its render and play functions, so the story's name should be descriptive of both.
I could also see the need for a long-form description for the story and we could probably get it with story descriptions extracted from jsdoc comments, maybe with some kind of jsDoc tag to isolate the test-specific documentation. However AFAIK Jest doesn't have a place to specify that kind of information. WDYT:
However AFAIK Jest doesn't have a place to specify that kind of information
Hmmmm, I think that's where I'd want to use the it description. I actually kind of like the current structure of showing Component -> StoryName -> it description. But that said, I've started naming my stories that are just for tests in the ShouldDoAThing convention, which accomplishes two goals:
Identifies the story's purpose as being a test.
Gives some context around what the test is trying to accomplish.
Maybe that's enough for now. But, it can result in story names that are a little bit long for my taste. 😂 Also, sometimes I just want to throw some assertions on a story that's serving a different purpose, and don't need to create a special story just for the test.
Describe the Feature
Sometimes it is nice to give some extra context around what the test is doing, and I find that the story name is not always an ideal place for this. I've taken to just adding comments at the top of my
play
function, but these don't show up in the test result output of course. It might be nice to have a way to customize what is shown there instead of always justsmoke-test
orplay-test
.Additional context
I'm not really sure how'd you'd accomplish this, short of adding another property onto CSF objects, which does not feel ideal. My only other idea would be to allow a return value from play functions, which you could use to pass
before
/after
hooks, and maybe also a description.The text was updated successfully, but these errors were encountered: