Last active
July 31, 2018 18:47
-
-
Save yann-yinn/ab15106c776a1f14cac3458203e18e19 to your computer and use it in GitHub Desktop.
How to unit test a Vue.js / Nuxt.js component that uses <nuxt-link> and store
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Minimal Webpack config to supply to units tests. | |
// This is not actually used by Nuxt but instead mirrors | |
// the resolve and loader rules. | |
const resolve = require('path').resolve; | |
// resolve to absolute path where "npm test" is running from | |
const root = resolve('.') | |
module.exports = { | |
resolve: { | |
modules: [root + '/node_modules'], | |
extensions: ['.js', '.vue'], | |
alias: { | |
'~': root, | |
'static': root + '/static', // use in template with <img src="~static/nuxt.png" /> | |
'~static': root + '/static', | |
'assets': root + '/assets', // use in template with <img src="~static/nuxt.png" /> | |
'~assets': root + '/assets', | |
'~plugins': root + '/plugins', | |
'~store': root + '/.nuxt/store', | |
'~router': root + '/.nuxt/router', | |
'~pages': root + '/pages', | |
'~components': root + '/components', | |
'~lib': root + '/lib', | |
} | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
loader: 'babel-loader', | |
}, | |
{ | |
test: /\.vue$/, | |
exclude: /node_modules/, | |
loader: 'vue-loader', | |
} | |
] | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where can found
webpack.config.js
?I am seeing so many
webpack.config.js
in in node_module