Avoid dist directory cluttering when running unit tests #398
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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