This PR changes the configuration in vue.config.js when in test mode to avoid an unsuitable behaviour introduced, apparently, when updating to Vue-CLI 3...
For now, when you run the unit tests, karma-webpack outputs the results in the dist directory, potentially destroying your latest build and adding some files only related to tests (common.js and runtime.js).
The reason is that when Vue-CLI 2 was used, Karma was one of the test runners recommended by Vue, so configuration was adapted for it. If you go back in time, you'll see that webpack configuration was almost empty in test mode compared to dev mode.
In Vue-CLI, the recommended test runner was mochapack which works completely differently. But most important, as stated in their documentation, it is written in a way that nothing is ever written on the disk by webpack, all stays is memory.
So there are two tweaks made by this PR in the config file:
Remove the unneeded plugins from webpack configuration in order to behave closer to like it was in Vue-CLI 2
This PR changes the configuration in
vue.config.js
when in test mode to avoid an unsuitable behaviour introduced, apparently, when updating to Vue-CLI 3...For now, when you run the unit tests,
karma-webpack
outputs the results in thedist
directory, potentially destroying your latest build and adding some files only related to tests (common.js and runtime.js).The reason is that when Vue-CLI 2 was used,
Karma
was one of the test runners recommended by Vue, so configuration was adapted for it. If you go back in time, you'll see that webpack configuration was almost empty in test mode compared to dev mode.In Vue-CLI, the recommended test runner was
mochapack
which works completely differently. But most important, as stated in their documentation, it is written in a way that nothing is ever written on the disk bywebpack
, all stays is memory.So there are two tweaks made by this PR in the config file:
karma-webpack
is taken, effectively outputting the build inside a temporary directory