Just throwing an idea out there.
I know Flow just did it so maybe Jest could do it too?
The suggestion is to treat resource files (images, fonts, etc) as exporting a string by default (dummy string is fine, filename is even better), and treat CSS as identity by default.
I think this corresponds to most popular setups, and doesn't really hurt people who don't use this stuff. And they can always override if they're not pleased with the default stubs.
I'm not sure about overwriting them because the keys are regex values – would we apply the user specified values first and then apply the Jest defaults if they fall through? That way people won't be able to get rid of the defaults, though, just overwrite them.
What function does getting rid of defaults serve practically? I’m trying to imagine a scenario where this would be beneficial but can’t quite see it. If you want to disallow importing CSS, you normally do this at the bundler level—your code just wouldn’t compile.
I was thinking of running Jest inside of electron and rendering real apps inside of an iframe, including images and wanted to preserve option value :D
My two cents, we had to workaroud this manually in some places:
If this was the default this would be a lot easier in most situations, at least for us.
It would be nice to have defaults for it. I spent around 1 hour figuring out how to do that.
Wontfix for now.
Most helpful comment
My two cents, we had to workaroud this manually in some places:
If this was the default this would be a lot easier in most situations, at least for us.