diff --git a/.gitignore b/.gitignore index bf50d518..de3cc231 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ app/assets/javascripts/webpacked # Ignore all logfiles and tempfiles. log/*.log tmp +.tmp coverage diff --git a/package.json b/package.json index 655fa0b2..5c72ffe6 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "build": "webpack", "build:watch": "webpack --watch", - "test": "mocha --compilers js:babel-core/register frontend/test", + "test": "mocha-webpack --webpack-config webpack.test.config.js frontend/test", "eslint": "eslint frontend", "eslint:fix": "eslint --fix frontend" }, diff --git a/webpack.config.js b/webpack.config.js index 13cf6a65..4c650ed2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -5,8 +5,12 @@ const NODE_ENV = process.env.NODE_ENV || 'development' const plugins = [ new webpack.DefinePlugin({ "process.env.NODE_ENV": `"${NODE_ENV}"` - }) + }), + new webpack.IgnorePlugin(/^mock-firmata$/), // work around bindings.js error + new webpack.ContextReplacementPlugin(/bindings$/, /^$/) // work around bindings.js error ] +const externals = ["bindings"] // work around bindings.js error + if (NODE_ENV === 'production') { plugins.push(new webpack.optimize.DedupePlugin()) plugins.push(new webpack.optimize.UglifyJsPlugin({ @@ -26,6 +30,7 @@ const devtool = NODE_ENV === 'production' ? undefined : 'cheap-module-eval-sourc module.exports = { context: __dirname, plugins, + externals, devtool, module: { preLoaders: [ diff --git a/webpack.test.config.js b/webpack.test.config.js new file mode 100644 index 00000000..518835d4 --- /dev/null +++ b/webpack.test.config.js @@ -0,0 +1,5 @@ +const config = require('./webpack.config') + +config.target = 'node' + +module.exports = config