Closed CristhianMotoche closed 1 year ago
In order to stop requesting the users for a name for the golden files, it would be great to get that information from the test itself. I already requested some information about it in the hspec repository. My goal is to make the golden test need less config and maybe at some point have more cool features related to snapshot testing like the ones from Jest.
I think this can be implemented without any changes to Hspec. Try something along the lines of:
golden :: String -> IO String -> Spec
golden description action = do
path <- (++ [description]) <$> getSpecDescriptionPath
it description $ do
action >>= defaultGolden (intercalate '-' path)
Indeed, that seems like a very easy approach. Thanks a lot @sol !
In order to stop requesting the users for a name for the golden files, it would be great to get that information from the test itself. I already requested some information about it in the hspec repository. My goal is to make the golden test need less config and maybe at some point have more cool features related to snapshot testing like the ones from Jest.