Cleaning up make test-client. Adding to build. (#2984)

Этот коммит содержится в:
Christopher Speller
2016-05-13 16:17:07 -04:00
родитель 39b520e38e
Коммит 587ddde587
7 изменённых файлов: 87 добавлений и 157 удалений

Просмотреть файл

@@ -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

Просмотреть файл

@@ -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\""
}
}

Просмотреть файл

@@ -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();
}
);

Просмотреть файл

@@ -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;

Просмотреть файл

@@ -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;