From df06bb740f9913eabdffff5f4daa29d257d00daa Mon Sep 17 00:00:00 2001 From: Mael Date: Thu, 15 Mar 2018 17:39:21 +0100 Subject: [PATCH] :sparkles: Simplification du webpack de test --- package.json | 10 +++---- source/webpack.test.config.js | 53 ----------------------------------- source/webpack.test.js | 13 +++++++++ 3 files changed, 18 insertions(+), 58 deletions(-) delete mode 100644 source/webpack.test.config.js create mode 100644 source/webpack.test.js diff --git a/package.json b/package.json index f0c5ec218..386095188 100644 --- a/package.json +++ b/package.json @@ -104,11 +104,11 @@ "start": "node source/server.js", "externalize": "node source/externalize.js", "compile": "webpack --config source/webpack.prod.js", - "test": "mocha-webpack --webpack-config source/webpack.test.config.js --require source-map-support/register --require test/helpers/browser.js \"test/**/*.test.js\"", - "test-watch": "mocha-webpack --webpack-config source/webpack.test.config.js --require source-map-support/register --require test/helpers/browser.js \"test/**/*.test.js\" --watch", - "test-meca": "mocha-webpack --webpack-config source/webpack.test.config.js --require source-map-support/register --require test/helpers/browser.js test/mecanisms.test.js --watch", - "test-rules": "mocha-webpack --webpack-config source/webpack.test.config.js --require source-map-support/register --require test/helpers/browser.js test/real-rules.test.js --watch", - "test-inversions": "mocha-webpack --webpack-config source/webpack.test.config.js --require source-map-support/register --require test/helpers/browser.js \"test/inversion.test.js\" --watch", + "test": "mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --require test/helpers/browser.js \"test/**/*.test.js\"", + "test-watch": "mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --require test/helpers/browser.js \"test/**/*.test.js\" --watch", + "test-meca": "mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --require test/helpers/browser.js test/mecanisms.test.js --watch", + "test-rules": "mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --require test/helpers/browser.js test/real-rules.test.js --watch", + "test-inversions": "mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --require test/helpers/browser.js \"test/inversion.test.js\" --watch", "heroku-postbuild": "yarn install --production=false && yarn compile" } } diff --git a/source/webpack.test.config.js b/source/webpack.test.config.js deleted file mode 100644 index 2c7c5feb1..000000000 --- a/source/webpack.test.config.js +++ /dev/null @@ -1,53 +0,0 @@ -var webpack = require('webpack'), - path = require('path') - -module.exports = { - devtool: 'cheap-module-source-map', - resolve: { - alias: { - Engine: path.resolve('source/engine/'), - Règles: path.resolve('source/règles/'), - Components: path.resolve('source/components/') - } - }, - module: { - loaders: [ - { - // slow : ~ 1s - test: /\.css$/, - loader: 'ignore-loader' - }, - { - test: /\.html$/, - loader: 'ignore-loader' - }, - { - test: /\.yaml$/, - loader: 'json-loader!yaml-loader' - }, - { - test: /\.js$/, - exclude: /node_modules/, - loader: 'babel-loader' - }, - { - test: /\.csv$/, - loader: 'csv-loader', - options: { - dynamicTyping: true, - header: true, - skipEmptyLines: true - } - }, - { - //slow : ~ 3 seconds - test: /\.(jpe?g|png|gif|svg)$/i, - loader: 'ignore-loader' - }, - { - test: /\.ne$/, - loader: 'babel-loader!nearley-loader' - } - ] - } -} diff --git a/source/webpack.test.js b/source/webpack.test.js new file mode 100644 index 000000000..a09f33864 --- /dev/null +++ b/source/webpack.test.js @@ -0,0 +1,13 @@ +var webpack = require('webpack'), + path = require('path'), + HardSourceWebpackPlugin = require('hard-source-webpack-plugin'), + common = require('./webpack.common.js') + +module.exports = { + ...common, + mode: 'development', + plugins: [ + new webpack.EnvironmentPlugin({ NODE_ENV: 'development' }), + new HardSourceWebpackPlugin() + ] +}