* [html5] move intro config to config file for test
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/5addc15c Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/5addc15c Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/5addc15c Branch: refs/heads/0.15-dev Commit: 5addc15c86558ec8ee1e2d1c34fb52f9344c8fc6 Parents: 500a3b0 Author: erha19 <faterr...@gmail.com> Authored: Mon Jul 10 14:31:38 2017 +0800 Committer: erha19 <faterr...@gmail.com> Committed: Mon Jul 10 14:31:38 2017 +0800 ---------------------------------------------------------------------- build/config.js | 15 +++++------ build/karma.vue.conf.js | 64 ++++++++++++++++++++------------------------ 2 files changed, 35 insertions(+), 44 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/5addc15c/build/config.js ---------------------------------------------------------------------- diff --git a/build/config.js b/build/config.js index 9ad7506..4325f2b 100644 --- a/build/config.js +++ b/build/config.js @@ -1,3 +1,4 @@ + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -83,13 +84,9 @@ const configs = { moduleName: 'WeexVueRender', entry: absolute('html5/render/vue/index.js'), dest: absolute('packages/weex-vue-render/dist/index.js'), - intro:`describe('ignore inject function from postcss', function () { - it('ignore', function () { - var shouldBe = 'test' - var expected = __$styleInject('.body{}',shouldBe) - expect(shouldBe).to.be.equal(expected) - }) - })`, + banner:` +console.log('START WEEX VUE RENDER: ${subversion['vue-render']}, Build ${now()}.'); +window._jslib_init_start = window.performance && window.performance.now && window.performance.now() || +new Date();\n\n`, format: 'umd', plugins: [ postcss(), @@ -112,7 +109,7 @@ function getConfig (name, minify) { entry: opt.entry, dest: minify ? opt.dest.replace(/\.js$/, '.min.js') : opt.dest, format: opt.format, - intro: opt.intro, + banner: opt.banner, plugins: opt.plugins.concat([ json(), replace({ @@ -152,4 +149,4 @@ function now () { return (new Date(time)).toISOString().replace('T', ' ').substring(0, 16) } -module.exports = getConfig +module.exports = getConfig \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/5addc15c/build/karma.vue.conf.js ---------------------------------------------------------------------- diff --git a/build/karma.vue.conf.js b/build/karma.vue.conf.js index 0e750af..7a69d35 100644 --- a/build/karma.vue.conf.js +++ b/build/karma.vue.conf.js @@ -20,20 +20,16 @@ var rollupConfig = require('./config')('weex-vue-render', true) var path = require('path') var flow = require('rollup-plugin-flow') -function absolute (pa) { +function absolute(pa) { return path.resolve(__dirname, pa) } - var removeConfigs = ['entry', 'dest', 'banner'] var removePlugins = ['eslint', 'uglify', 'flow-remove-type'] - removeConfigs.forEach(cfg => { delete rollupConfig[cfg] }) - var plugins = rollupConfig.plugins.slice() rollupConfig.plugins = [] - for (var i = 0, l = plugins.length; i < l; i++) { var plg = plugins[i] var isRemove = false @@ -45,57 +41,55 @@ for (var i = 0, l = plugins.length; i < l; i++) { isRemove = true } }) - if (!isRemove) { rollupConfig.plugins.push(plg) } + if (!isRemove) { + rollupConfig.plugins.push(plg) + } } - /** * rollup-plugin-flow-no-whiitespace cause fatial error. * use rollup-plugin-flow instead, since no soucemap needed, it's acceptable for extra whitespaces. */ rollupConfig.plugins.splice(-2, 1, flow()) - rollupConfig.format = 'iife' rollupConfig.sourceMap = 'inline' - +rollupConfig.intro = `describe('ignore inject function from postcss', function () { + it('ignore', function () { + var shouldBe = 'test' + var expected = __$styleInject('.body{}',shouldBe) + expect(shouldBe).to.be.equal(expected) + }) + })` + module.exports = function (config) { config.set({ frameworks: ['mocha', 'sinon-chai'], browsers: ['PhantomJS'], - files: [ - '../html5/test/render/vue/utils/*.js', - '../html5/test/render/vue/core/*.js', - '../html5/test/render/vue/!(utils|core)/*.js' - ], - exclude: [ - '../html5/test/render/vue/helper/*.js', - '../html5/test/render/vue/vender/**/*.js', - '../html5/test/render/vue/data/**/*.js' + files: ['../html5/test/render/vue/utils/*.js', + // '../html5/test/render/vue/core/*.js', + // '../html5/test/render/vue/!(utils|core)/*.js' ], - - // singleRun: false, - singleRun: true, - + exclude: ['../html5/test/render/vue/helper/*.js', '../html5/test/render/vue/vender/**/*.js', '../html5/test/render/vue/data/**/*.js'], + singleRun: false, + // singleRun: true, reporters: ['mocha', 'coverage'], coverageReporter: { - reporters: [ - { type: 'html', dir: absolute('../coverage'), subdir: 'vue-renderer' }, - { type: 'text-summary', dir: absolute('../coverage'), subdir: 'vue-renderer' } - ] + reporters: [{ + type: 'html', + dir: absolute('../coverage'), + subdir: 'vue-renderer' + }, { + type: 'text-summary', + dir: absolute('../coverage'), + subdir: 'vue-renderer' + }] }, - browserDisconnectTimeout:10000, + browserDisconnectTimeout: 10000, preprocessors: { '../html5/test/**/*.js': ['rollup'], '../html5/test/**/!(components|examples|core)/*.js': ['rollup', 'coverage'] }, rollupPreprocessor: rollupConfig, - - plugins: [ - 'karma-coverage', - 'karma-mocha', - 'karma-mocha-reporter', - 'karma-phantomjs-launcher', - 'karma-rollup-preprocessor', - 'karma-sinon-chai' + plugins: ['karma-coverage', 'karma-mocha', 'karma-mocha-reporter', 'karma-phantomjs-launcher', 'karma-rollup-preprocessor', 'karma-sinon-chai' // 'karma-sourcemap-loader', // 'karma-webpack' ]