I create the backend of my application using webpack (using the babel bootloader and other bootloaders). I want to test individual modules of the mentioned backend using any of the usual testing tools, such as Mocha, as I could do with regular Node modules.
My build process creates one large set of my files (node_modules - externalized), which obviously does not allow me to test the individual modules contained in this package.
What I want:
- Tests modules that can be compiled by Webpack.
- Modules that can be compiled by Webpack and tested by the specified test modules.
- Be able to use tools like rewire to inject fake dependencies.
- Run one test module.
- Ability to use Webpack view mode.
Possible approach:
I would say that each test module corresponds to an entry point in Webpack. Both test modules and test modules can then be created by Webpack. It will also automatically enable Webpack view mode. However, each new test module should be added to the entry point to the Webpack configuration, which seems wrong and tedious.
Using this approach, most testing tools will only work because they can simply use the output from the test module entry points.
- . Node require, , Webpack, . , .
, ? Webpack , , .