60frames / jestpack

Jest Webpack Integration
MIT License
66 stars 3 forks source link

Automatic tests detection #16

Open isaac-peka opened 8 years ago

isaac-peka commented 8 years ago

Great work on this library, as someone new to node it's really frustrating the way all of these great things don't just play nicely together.

It seems like using jestpack in it current form, you lose the benefit of the automatic tests detection since it forces you to maintain a registry of tests in your webpack config. Is there a way you could support plugging in something like webpack isomorphic tools, so there's no need to statically create a tests bundle?

I'd be happy to put together a proof of concept if you can give me a few pointers in the right direction about how something like that could be done, or if it's possible at all.

richardscarrott commented 8 years ago

@sampeka I have to admit running bundled tests isn't ideal at all.

From what I can tell webpack isomorphic tools overloads Node's require which, in effect, is what Jest is doing itself so they wouldn't work well together.

There's probably potential to write a module loader for Jest which works in a similar way to isomorphic tools however I recently came across babel-plugin-webpack-loaders which, with a bit of performance tweaking, could be a viable approach as it would be far less intrusive to Jest so could take advantage of all the existing and future optimizations Jest makes because it's designed with babel transformations in mind.

I'm planning on putting something together at some stage soon.