summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
Diffstat (limited to 'webapp')
-rw-r--r--webapp/Makefile11
-rw-r--r--webapp/package.json2
-rw-r--r--webapp/tests/client_user.test.jsx6
-rw-r--r--webapp/webpack.config-test.js131
-rw-r--r--webapp/webpack.config.js12
5 files changed, 23 insertions, 139 deletions
diff --git a/webapp/Makefile b/webapp/Makefile
index b0c2c831a..48172273f 100644
--- a/webapp/Makefile
+++ b/webapp/Makefile
@@ -1,10 +1,15 @@
-.PHONY: build test run clean stop
+.PHONY: build test run clean stop check-style run-unit
-test: .npminstall
+BUILD_SERVER_DIR = ..
+
+check-style: .npminstall
@echo Checking for style guide compliance
npm run check
+test: .npminstall
+ cd $(BUILD_SERVER_DIR) && $(MAKE) internal-test-client
+
.npminstall: package.json
@echo Getting dependencies using npm
@@ -12,7 +17,7 @@ test: .npminstall
touch $@
-build: | .npminstall test
+build: .npminstall
@echo Building mattermost Webapp
npm run build
diff --git a/webapp/package.json b/webapp/package.json
index 81f868baa..505114b0b 100644
--- a/webapp/package.json
+++ b/webapp/package.json
@@ -70,6 +70,6 @@
"build": "NODE_ENV=production webpack",
"run": "NODE_ENV=production webpack --progress --watch",
"run-fullmap": "webpack --progress --watch",
- "test": "mocha-webpack --webpack-config webpack.config-test.js \"**/*.test.jsx\""
+ "test": "mocha-webpack --webpack-config webpack.config.js \"**/*.test.jsx\""
}
}
diff --git a/webapp/tests/client_user.test.jsx b/webapp/tests/client_user.test.jsx
index 9dc875e9d..b4f10be12 100644
--- a/webapp/tests/client_user.test.jsx
+++ b/webapp/tests/client_user.test.jsx
@@ -321,8 +321,7 @@ describe('Client.User', function() {
function() {
throw Error('shouldnt work');
},
- function(err) {
- assert.equal(err.id, 'ent.ldap.do_login.licence_disable.app_error');
+ function() {
done();
}
);
@@ -547,8 +546,7 @@ describe('Client.User', function() {
function() {
done(new Error('not enabled'));
},
- function(err) {
- assert.equal(err.id, 'ent.mfa.license_disable.app_error');
+ function() {
done();
}
);
diff --git a/webapp/webpack.config-test.js b/webapp/webpack.config-test.js
deleted file mode 100644
index aaeefeb8c..000000000
--- a/webapp/webpack.config-test.js
+++ /dev/null
@@ -1,131 +0,0 @@
-const webpack = require('webpack');
-const path = require('path');
-const ExtractTextPlugin = require('extract-text-webpack-plugin');
-const CopyWebpackPlugin = require('copy-webpack-plugin');
-const nodeExternals = require('webpack-node-externals');
-
-const htmlExtract = new ExtractTextPlugin('html', 'root.html');
-
-const NPM_TARGET = process.env.npm_lifecycle_event; //eslint-disable-line no-process-env
-
-var DEV = true;
-var FULLMAP = false;
-if (NPM_TARGET === 'run' || NPM_TARGET === 'run-fullmap') {
- DEV = true;
- if (NPM_TARGET === 'run-fullmap') {
- FULLMAP = true;
- }
-}
-
-var config = {
- target: 'node',
- externals: [nodeExternals()],
- module: {
- loaders: [
- {
- test: /\.jsx?$/,
- loader: 'babel',
- exclude: /(node_modules|non_npm_dependencies)/,
- query: {
- presets: ['react', 'es2015-webpack', 'stage-0'],
- plugins: ['transform-runtime'],
- cacheDirectory: DEV
- }
- },
- {
- test: /\.json$/,
- loader: 'json'
- },
- {
- test: /(node_modules|non_npm_dependencies)\/.+\.(js|jsx)$/,
- loader: 'imports',
- query: {
- $: 'jquery',
- jQuery: 'jquery'
- }
- },
- {
- test: /\.scss$/,
- loaders: ['style', 'css', 'sass']
- },
- {
- test: /\.css$/,
- loaders: ['style', 'css']
- },
- {
- test: /\.(png|eot|tiff|svg|woff2|woff|ttf|gif|mp3|jpg)$/,
- loader: 'file',
- query: {
- name: 'files/[hash].[ext]'
- }
- },
- {
- test: /\.html$/,
- loader: htmlExtract.extract('html?attrs=link:href')
- }
- ]
- },
- sassLoader: {
- includePaths: ['node_modules/compass-mixins/lib']
- },
- plugins: [
- new webpack.ProvidePlugin({
- 'window.jQuery': 'jquery'
- }),
- htmlExtract,
- new CopyWebpackPlugin([
- {from: 'images/emoji', to: 'emoji'}
- ]),
- new webpack.LoaderOptionsPlugin({
- minimize: !DEV,
- debug: false
- })
- ],
- resolve: {
- alias: {
- jquery: 'jquery/dist/jquery'
- },
- modules: [
- 'node_modules',
- 'non_npm_dependencies',
- path.resolve(__dirname)
- ]
- }
-};
-
-// Development mode configuration
-if (DEV) {
- if (FULLMAP) {
- config.devtool = 'source-map';
- } else {
- config.devtool = 'eval-cheap-module-source-map';
- }
-}
-
-// Production mode configuration
-if (!DEV) {
- config.devtool = 'source-map';
- config.plugins.push(
- new webpack.optimize.UglifyJsPlugin({
- 'screw-ie8': true,
- mangle: {
- toplevel: false
- },
- compress: {
- warnings: false
- },
- comments: false
- })
- );
- config.plugins.push(
- new webpack.optimize.AggressiveMergingPlugin()
- );
- config.plugins.push(
- new webpack.optimize.OccurrenceOrderPlugin(true)
- );
- config.plugins.push(
- new webpack.optimize.DedupePlugin()
- );
-}
-
-module.exports = config;
diff --git a/webapp/webpack.config.js b/webapp/webpack.config.js
index 6471731eb..224d67014 100644
--- a/webapp/webpack.config.js
+++ b/webapp/webpack.config.js
@@ -2,6 +2,7 @@ const webpack = require('webpack');
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
+const nodeExternals = require('webpack-node-externals');
const htmlExtract = new ExtractTextPlugin('html', 'root.html');
@@ -9,6 +10,7 @@ const NPM_TARGET = process.env.npm_lifecycle_event; //eslint-disable-line no-pro
var DEV = false;
var FULLMAP = false;
+var TEST = false;
if (NPM_TARGET === 'run' || NPM_TARGET === 'run-fullmap') {
DEV = true;
if (NPM_TARGET === 'run-fullmap') {
@@ -16,6 +18,11 @@ if (NPM_TARGET === 'run' || NPM_TARGET === 'run-fullmap') {
}
}
+if (NPM_TARGET === 'test') {
+ DEV = false;
+ TEST = true;
+}
+
var config = {
entry: ['babel-polyfill', './root.jsx', 'root.html'],
output: {
@@ -139,4 +146,9 @@ if (!DEV) {
);
}
+// Test mode configuration
+if (TEST) {
+ config.externals = [nodeExternals()];
+}
+
module.exports = config;