Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

Commit

Permalink
feat(test): add unit test for brower with webpack-dev-server
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed Dec 7, 2015
1 parent b72bcb6 commit 42865bc
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
37 changes: 37 additions & 0 deletions config/webpack.dev.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
var webpack = require('webpack')

module.exports = {
entry: 'mocha!./test/index.js',
output: {
path: './test',
filename: 'specs.js',
publicPath: '/'
},
devtool: 'source-map',
module: {
loaders: [{
test: /\.js$/,
exclude: /node_modules|vue\/dist/,
loader: 'babel',
query: {
presets: ['es2015'],
plugins: [
'babel-plugin-espower'
]
}
}],
postLoaders: [{
test: /\.json$/,
loader: 'json'
}]
},
devServer: {
contentBase: './test',
port: 8081,
hot: true,
inline: true
},
plugins: [
new webpack.HotModuleReplacementPlugin()
]
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@
"karma-sourcemap-loader": "^0.3.5",
"karma-webpack": "^1.7.0",
"mocha": "^2.3.4",
"mocha-loader": "^0.7.1",
"phantomjs": "^1.9.18",
"power-assert": "^1.2.0",
"rollup": "^0.21.1",
"rollup-plugin-babel": "^2.2.0",
"rollup-plugin-replace": "^1.1.0",
"uglify-js": "^2.6.1",
"vue": "^1.0.10",
"webpack": "^1.12.9"
"webpack": "^1.12.9",
"webpack-dev-server": "^1.14.0"
},
"files": [
"dist/vue-plugin-boilerplate.js",
Expand All @@ -59,6 +61,7 @@
"scripts": {
"build": "node config/build.js",
"clean": "rm -rf coverage && rm -rf dist",
"dev": "webpack-dev-server --quiet --config config/webpack.dev.conf.js --host 0.0.0.0",
"lint": "eslint src test config",
"test": "karma start config/karma.conf.js",
"watch": "webpack --watch --config config/webpack.conf.js"
Expand Down
10 changes: 10 additions & 0 deletions test/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>plugin tests</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="specs.js"></script>
</head>
<body>
</body>
</html>

0 comments on commit 42865bc

Please sign in to comment.