Skip to content

Commit

Permalink
Updated vue.config.js to avoid dist directory pollution when running …
Browse files Browse the repository at this point in the history
…unit tests
  • Loading branch information
sronveaux committed Jun 6, 2024
1 parent 3810f62 commit a92ebc1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,25 @@ module.exports = defineConfig({
// which can run under Chrome headless. Avoid warnings due to custom entries
// and customized filenames. Enable correct code coverage of .vue files.
// Disable Vuetify treeshaking.
// Ensure build is sent to a temporary directory and keep only necessary plugins.
if (process.env.NODE_ENV === 'test') {
const PLUGINS_TO_KEEEP = [
'VueLoaderPlugin',
'DefinePlugin',
'CaseSensitivePathsPlugin',
'FriendlyErrorsWebpackPlugin'
]

config.devtool = 'eval'
config.optimization.runtimeChunk = false
config.optimization.splitChunks = false
config.plugins = config.plugins.filter(plugin => plugin.constructor.name !== 'VuetifyLoaderPlugin')
config.plugins = config.plugins.filter(plugin =>
PLUGINS_TO_KEEEP.includes(plugin.constructor.name)
)
delete config.target
delete config.entry
delete config.output.filename
delete config.output.path
}
},

Expand Down

0 comments on commit a92ebc1

Please sign in to comment.