Closed andyrichardson closed 4 years ago
Quick note unrelated to the issue: I think you want to pass fullScreen: true
to getFixtureUrls
here.
You make a solid case. These alternative methods would indeed be useful:
getCosmosConfigSync
getCosmosConfig
is already syncgetFixtureUrlsSync
getFixturesSync
Quick note unrelated to the issue: I think you want to pass fullScreen: true to getFixtureUrls here.
Hero!
You make a solid case
I'm humbled! This is pretty core to one of our projects so I'll see if I can spend some time on it today.
About
The dev utilities exported from the "react-cosmos" package are great but their async implementation can make basic usage tricky or impossible.
It would be awesome if a sync version of these packages could be provided.
Here's an example of how I'm currently using
getFixtureUrls
. Because the function is async, there's no way to make use of test.each.Another example is a bash script which needs the fixture urls. There's no easy way to get them because something such as this would not work due to the async implementation
URLS=$(node -x "require('react-cosmos').getFixtureUrls()")
Final example, this was a hack I had to do to make a backstop config that uses fixture URLs. Synchronously, I would have just done this: