From fb7f7f077ffee9cd3fcbcbe37106fb68db4dfdec Mon Sep 17 00:00:00 2001 From: dhilt Date: Mon, 13 Nov 2017 23:42:48 +0300 Subject: [PATCH] prod build & test --- package.json | 6 ++++-- test/config/karma.conf.files.js | 24 ++++++++++++++---------- test/config/karma.conf.js | 18 ++++++++++-------- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 798c6321..c76fbbf5 100644 --- a/package.json +++ b/package.json @@ -19,10 +19,12 @@ }, "license": "MIT", "scripts": { - "build": "webpack --config webpack/config.js", + "prod-build": "webpack --config webpack/config.js", + "prod-test": "karma start test/config/karma.conf.js", "dev-build": "webpack --config webpack/config.js", "dev-test": "karma start test/config/karma.conf.js", - "test": "concurrently --kill-others --raw \"npm run dev-build\" \"npm run dev-test\"" + "test": "concurrently --kill-others --raw \"npm run dev-build\" \"npm run dev-test\"", + "build": "npm run prod-build && npm run prod-test" }, "devDependencies": { "babel-core": "^6.24.1", diff --git a/test/config/karma.conf.files.js b/test/config/karma.conf.files.js index 4da93c79..be2776a8 100644 --- a/test/config/karma.conf.files.js +++ b/test/config/karma.conf.files.js @@ -7,19 +7,23 @@ var files = [ '../misc/test.css', '../misc/datasources.js', '../misc/scaffolding*.js', - '../*Spec.js', + '../*Spec.js' +]; + +module.exports.development = files.concat([ + '../../temp/ui-scroll.js', + '../../temp/ui-scroll-grid.js', { - pattern: scrollerPath + '*.js.map', + pattern: '../../temp/*.js.map', included: false } -]; - -module.exports.defaultFiles = files.concat([ - scrollerPath + 'ui-scroll.js', - scrollerPath + 'ui-scroll-grid.js' ]); -module.exports.compressedFiles = files.concat([ - scrollerPath + 'ui-scroll.min.js', - scrollerPath + 'ui-scroll-grid.min.js' +module.exports.production = files.concat([ + '../../dist/ui-scroll.min.js', + '../../dist/ui-scroll-grid.min.js', + { + pattern: '../../dist/*.js.map', + included: false + } ]); diff --git a/test/config/karma.conf.js b/test/config/karma.conf.js index 0b81db4a..481cf095 100644 --- a/test/config/karma.conf.js +++ b/test/config/karma.conf.js @@ -1,6 +1,8 @@ -var chrome = process.platform === 'linux' ? 'Chromium' : 'Chrome'; -var firefox = 'Firefox'; -var ie = 'IE'; +const chrome = process.platform === 'linux' ? 'Chromium' : 'Chrome'; +const firefox = 'Firefox'; +const ie = 'IE'; + +const ENV = (process.env.npm_lifecycle_event.indexOf('dev') === 0) ? 'development' : 'production'; module.exports = function (config) { config.set({ @@ -9,21 +11,21 @@ module.exports = function (config) { frameworks: ['jasmine'], - files: require('./karma.conf.files.js').defaultFiles, + files: require('./karma.conf.files.js')[ENV], exclude: [], reporters: ['dots'], - port: 8082, + port: ENV === 'development' ? 9100 : 8082, colors: true, logLevel: config.LOG_INFO, - autoWatch: true, + autoWatch: ENV === 'development', - keepalive: true, + keepalive: ENV === 'development', browsers: process.env.TRAVIS ? [firefox, chrome] : @@ -31,6 +33,6 @@ module.exports = function (config) { captureTimeout: 60000, - singleRun: false + singleRun: ENV !== 'development' }); };