diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js index 74a6c9a0b10..e504deef9cf 100644 --- a/config/webpack.config.dev.js +++ b/config/webpack.config.dev.js @@ -12,12 +12,16 @@ var autoprefixer = require('autoprefixer'); var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); +function isInDebugMode() { + return process.argv.some(function (item) { return item.indexOf('--debug-template') > -1 }); +} + // TODO: hide this behind a flag and eliminate dead code on eject. // This shouldn't be exposed to the user. var isInNodeModules = 'node_modules' === path.basename(path.resolve(path.join(__dirname, '..', '..'))); var relativePath = isInNodeModules ? '../../..' : '..'; -if (process.argv[2] === '--debug-template') { +if (isInDebugMode()) { relativePath = '../template'; } var srcPath = path.resolve(__dirname, relativePath, 'src'); diff --git a/scripts/start.js b/scripts/start.js index a7e39caf2ab..de0c47f51cd 100644 --- a/scripts/start.js +++ b/scripts/start.js @@ -16,10 +16,14 @@ var config = require('../config/webpack.config.dev'); var execSync = require('child_process').execSync; var opn = require('opn'); +function isSmokeTest() { + return process.argv.some(function (item) { return item.indexOf('--smoke-test') > -1 }); +} + // TODO: hide this behind a flag and eliminate dead code on eject. // This shouldn't be exposed to the user. var handleCompile; -if (process.argv[2] === '--smoke-test') { +if (isSmokeTest()) { handleCompile = function (err, stats) { if (err || stats.hasErrors() || stats.hasWarnings()) { process.exit(1); diff --git a/tasks/e2e.sh b/tasks/e2e.sh index 21813326dde..3a732bd0398 100755 --- a/tasks/e2e.sh +++ b/tasks/e2e.sh @@ -30,6 +30,16 @@ perl -i -p0e 's/bundledDependencies.*?]/bundledDependencies": []/s' package.json npm install scripts_path=$PWD/`npm pack` +# Test local start command +npm start -- --smoke-test + +# Test local build command +npm run build + +# Check for expected output +test -e build/*.html +test -e build/*.js + # Pack CLI cd global-cli npm install @@ -50,8 +60,8 @@ cd test-app npm run build # Check for expected output -test -e build/*.html || exit 1 -test -e build/*.js || exit 1 +test -e build/*.html +test -e build/*.js # Test the server npm start -- --smoke-test @@ -61,8 +71,8 @@ echo yes | npm run eject npm run build # Check for expected output -test -e build/*.html || exit 1 -test -e build/*.js || exit 1 +test -e build/*.html +test -e build/*.js # Test the server npm start -- --smoke-test