Closed wmertens closed 9 years ago
You're right... Any thoughts on using webpack config? I think that adding new option to package.json (which points to config) will help with this a lot
now that I think of it, wouldn't it be better to make jest a sort of loader for webpack? You'd have to require()
the tests which may be a little tedious, but it could then run the test automatically if the test changes, and vice versa. Or even make the tests a second entry point, and they would point to their dependencies properly...
@ColCh and if you could somehow load jest instead of running the binary, the tests could go a lot faster because it would have the full setup ready to run... That would be seriously awesome...
This is exactly webpack's loader behaviour. This script works like karma-webpack. Unfortunately I can't keep Jest loaded because webpack is used here as preprocessor (which is wrong by design)
As 0.2.0 it has possibility to load config for webpack. It's specified with jest-webpack-config package.json key. See test fixture for more info.
Closing since resolved
Cool thanks! I also realized that a jest-loader wouldn't work with webpack because it overrides require
to provide mocks. Webpack would not be able to know which ones are mocked.
...unless the jest-loader keeps track of mocks of course... hmmm.
Yes... That's another sort of problem. I think that should be implemented within jest-loader functionality.
This seems to ignore the webpack config, so it doesn't know about custom loaders like coffeescript and less, or am I mistaken?