From 833be494bb36baa05be3a73533753337eede3bb2 Mon Sep 17 00:00:00 2001 From: xuexb Date: Wed, 23 Aug 2017 12:28:19 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E4=BE=9D=E8=B5=96,=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 5f19d2ed..068b6ade 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,9 @@ "main": "layui.js", "license": "MIT", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "karma start karma.conf.js", + "test:cov": "npm test -- --reporters mocha,coverage", + "test:watch": "npm test -- --auto-watch --no-single-run" }, "repository": { "type": "git", @@ -23,7 +25,18 @@ "gulp-rename": "^1.2.2", "gulp-uglify": "^1.5.4", "gulp-zip": "^4.0.0", - "minimist": "^1.2.0" + "minimist": "^1.2.0", + "chai": "^3.5.0", + "karma": "^1.5.0", + "karma-chai": "^0.1.0", + "karma-chai-sinon": "^0.1.5", + "karma-coverage": "^1.1.1", + "karma-mocha": "^1.3.0", + "karma-mocha-reporter": "^2.2.3", + "karma-phantomjs-launcher": "^1.0.4", + "mocha": "^3.2.0", + "sinon": "^2.0.0", + "sinon-chai": "^2.8.0" }, "bugs": { "url": "https://github.com/sentsin/layui/issues" @@ -33,15 +46,6 @@ "test": "test" }, "dependencies": { - "gulp": "^3.9.1", - "gulp-uglify": "^1.5.4", - "gulp-minify-css": "^1.2.4", - "gulp-concat": "^2.6.0", - "gulp-header": "^1.8.8", - "gulp-if": "^2.0.1", - "gulp-rename": "^1.2.2", - "del": "^2.2.2", - "minimist": "^1.2.0" }, "keywords": [ "layui", From 67944ce224eb6882b0d47a69f4133adef333e0aa Mon Sep 17 00:00:00 2001 From: xuexb Date: Wed, 23 Aug 2017 12:28:34 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BF=BD=E7=95=A5?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=A6=86=E7=9B=96=E7=8E=87=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 770ac709..e5143c11 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ dir.txt release/ build/ +coverage/ \ No newline at end of file From f28819e903e70cfe80478b3b676b30f9154c9bac Mon Sep 17 00:00:00 2001 From: xuexb Date: Wed, 23 Aug 2017 12:29:22 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E6=8A=8A=E9=A2=84=E8=A7=88=E4=BE=8B?= =?UTF-8?q?=E5=AD=90=E8=BF=81=E7=A7=BB=E5=88=B0=20examples=20=E7=9B=AE?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {test => examples}/admin.html | 0 {test => examples}/all.html | 0 {test => examples}/button.html | 0 {test => examples}/carousel.html | 0 {test => examples}/code.html | 0 {test => examples}/element.html | 0 {test => examples}/extend.html | 0 {test => examples}/flow.html | 0 {test => examples}/form.html | 0 {test => examples}/js/child/test.js | 0 {test => examples}/js/index.js | 0 {test => examples}/json/table/demo1.json | 0 {test => examples}/json/table/demo2.json | 0 {test => examples}/laydate.html | 0 {test => examples}/layedit.html | 0 {test => examples}/layer.html | 0 {test => examples}/layout.html | 0 {test => examples}/laypage.html | 0 {test => examples}/table.html | 0 {test => examples}/tree.html | 0 {test => examples}/upload.html | 0 {test => examples}/util.html | 0 {test => examples}/xingzuo.html | 0 23 files changed, 0 insertions(+), 0 deletions(-) rename {test => examples}/admin.html (100%) rename {test => examples}/all.html (100%) rename {test => examples}/button.html (100%) rename {test => examples}/carousel.html (100%) rename {test => examples}/code.html (100%) rename {test => examples}/element.html (100%) rename {test => examples}/extend.html (100%) rename {test => examples}/flow.html (100%) rename {test => examples}/form.html (100%) rename {test => examples}/js/child/test.js (100%) rename {test => examples}/js/index.js (100%) rename {test => examples}/json/table/demo1.json (100%) rename {test => examples}/json/table/demo2.json (100%) rename {test => examples}/laydate.html (100%) rename {test => examples}/layedit.html (100%) rename {test => examples}/layer.html (100%) rename {test => examples}/layout.html (100%) rename {test => examples}/laypage.html (100%) rename {test => examples}/table.html (100%) rename {test => examples}/tree.html (100%) rename {test => examples}/upload.html (100%) rename {test => examples}/util.html (100%) rename {test => examples}/xingzuo.html (100%) diff --git a/test/admin.html b/examples/admin.html similarity index 100% rename from test/admin.html rename to examples/admin.html diff --git a/test/all.html b/examples/all.html similarity index 100% rename from test/all.html rename to examples/all.html diff --git a/test/button.html b/examples/button.html similarity index 100% rename from test/button.html rename to examples/button.html diff --git a/test/carousel.html b/examples/carousel.html similarity index 100% rename from test/carousel.html rename to examples/carousel.html diff --git a/test/code.html b/examples/code.html similarity index 100% rename from test/code.html rename to examples/code.html diff --git a/test/element.html b/examples/element.html similarity index 100% rename from test/element.html rename to examples/element.html diff --git a/test/extend.html b/examples/extend.html similarity index 100% rename from test/extend.html rename to examples/extend.html diff --git a/test/flow.html b/examples/flow.html similarity index 100% rename from test/flow.html rename to examples/flow.html diff --git a/test/form.html b/examples/form.html similarity index 100% rename from test/form.html rename to examples/form.html diff --git a/test/js/child/test.js b/examples/js/child/test.js similarity index 100% rename from test/js/child/test.js rename to examples/js/child/test.js diff --git a/test/js/index.js b/examples/js/index.js similarity index 100% rename from test/js/index.js rename to examples/js/index.js diff --git a/test/json/table/demo1.json b/examples/json/table/demo1.json similarity index 100% rename from test/json/table/demo1.json rename to examples/json/table/demo1.json diff --git a/test/json/table/demo2.json b/examples/json/table/demo2.json similarity index 100% rename from test/json/table/demo2.json rename to examples/json/table/demo2.json diff --git a/test/laydate.html b/examples/laydate.html similarity index 100% rename from test/laydate.html rename to examples/laydate.html diff --git a/test/layedit.html b/examples/layedit.html similarity index 100% rename from test/layedit.html rename to examples/layedit.html diff --git a/test/layer.html b/examples/layer.html similarity index 100% rename from test/layer.html rename to examples/layer.html diff --git a/test/layout.html b/examples/layout.html similarity index 100% rename from test/layout.html rename to examples/layout.html diff --git a/test/laypage.html b/examples/laypage.html similarity index 100% rename from test/laypage.html rename to examples/laypage.html diff --git a/test/table.html b/examples/table.html similarity index 100% rename from test/table.html rename to examples/table.html diff --git a/test/tree.html b/examples/tree.html similarity index 100% rename from test/tree.html rename to examples/tree.html diff --git a/test/upload.html b/examples/upload.html similarity index 100% rename from test/upload.html rename to examples/upload.html diff --git a/test/util.html b/examples/util.html similarity index 100% rename from test/util.html rename to examples/util.html diff --git a/test/xingzuo.html b/examples/xingzuo.html similarity index 100% rename from test/xingzuo.html rename to examples/xingzuo.html From 1c55deb97c30109b382f77796f70ddfd290ea4d4 Mon Sep 17 00:00:00 2001 From: xuexb Date: Wed, 23 Aug 2017 12:29:47 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E5=92=8C=E6=B5=8B=E8=AF=95=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- karma.conf.js | 126 +++++++++++++++++++++++++++ test/laytpl.js | 227 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 353 insertions(+) create mode 100644 karma.conf.js create mode 100644 test/laytpl.js diff --git a/karma.conf.js b/karma.conf.js new file mode 100644 index 00000000..25709a18 --- /dev/null +++ b/karma.conf.js @@ -0,0 +1,126 @@ +/** + * @file karma自动化测试配置 + * @author fe.xiaowu@gmail.com + */ + +/** + * 源文件 + * + * @type {Array} + */ +var sourceFileMap = [ + 'src/layui.js', + 'src/lay/modules/jquery.js', + 'src/lay/modules/carousel.js', + 'src/lay/modules/code.js', + 'src/lay/modules/element.js', + 'src/lay/modules/flow.js', + 'src/lay/modules/form.js', + 'src/lay/modules/laydate.js', + 'src/lay/modules/layedit.js', + 'src/lay/modules/layer.js', + 'src/lay/modules/laypage.js', + 'src/lay/modules/laytpl.js', + 'src/lay/modules/table.js', + 'src/lay/modules/tree.js', + 'src/lay/modules/upload.js', + 'src/lay/modules/util.js', + 'src/lay/modules/mobile/zepto.js', + 'src/lay/modules/mobile/layer-mobile.js', + 'src/lay/modules/mobile/upload-mobile.js', +]; + +/** + * 测试覆盖率文件, 要忽略 jquery.js、zepto.js + * + * @type {Object} + */ +var coverageFileMap = {}; +sourceFileMap.filter(function (uri) { + return !/(jquery|zepto)\.js$/.test(uri); +}).forEach(function (uri) { + coverageFileMap[uri] = ['coverage']; +}); + +module.exports = function(config) { + config.set({ + + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: '', + + // Important: 所有插件必须在此声明 + plugins: ['karma-*'], + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + // Important: 下列数组中文件将『逆序载入』 + frameworks: ['mocha', 'chai', 'chai-sinon'], + + + // list of files / patterns to load in the browser + files: sourceFileMap.concat('test/**/*.js'), + + + // list of files to exclude + exclude: [], + + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: coverageFileMap, + + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: [ + 'mocha' + // 'coverage' + ], + + coverageReporter: { + // specify a common output directory + dir: '.', + reporters: [ + // { type: 'html', subdir: 'report-html' }, + { + type: 'lcov', + subdir: 'coverage' + }, + { + type: 'text-summary' + } + ] + }, + + + // web server port + port: 9876, + + + // enable / disable colors in the output (reporters and logs) + colors: true, + + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + // Note: 如果要调试Karma,请设置为DEBUG + logLevel: config.LOG_INFO, + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: [ + 'PhantomJS' + ], + + + // enable / disable watching file and executing tests whenever any file changes + // Note: 代码改动自动运行测试,需要singleRun为false + autoWatch: false, + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + // 脚本调用请设为 true + singleRun: true + }); +}; \ No newline at end of file diff --git a/test/laytpl.js b/test/laytpl.js new file mode 100644 index 00000000..cb047a66 --- /dev/null +++ b/test/laytpl.js @@ -0,0 +1,227 @@ +/** + * @file laytpl - 测试 + * @author xuexb + */ + +/* global layui */ + +var laytpl = layui.laytpl; + +describe('laytpl', function () { + it('param is error', function () { + [ + [], {}, + null, + 1, + true + ].forEach(function (key) { + expect(laytpl(key)).to.have.string('Laytpl Error'); + }); + }); + + it('async render callback', function (done) { + expect(laytpl('').render()).to.have.string('Laytpl Error'); + + laytpl('{{ d.name }}是一位公猿').render({ + name: '贤心' + }, function (result) { + expect(result).to.equal('贤心是一位公猿'); + done(); + }); + }); + + it('sync result', function () { + var result = laytpl('{{ d.name }}是一位公猿').render({ + name: '贤心' + }); + expect(result).to.equal('贤心是一位公猿'); + }); + + it('cached', function () { + var compile = laytpl('{{ d.name }}'); + + expect(compile.render({ + name: 1 + })).to.equal('1'); + + expect(compile.render({ + name: 2 + })).to.equal('2'); + }); + + it('unescape result', function () { + var result = laytpl('{{ d.name }}
').render({ + name: 'laytpl' + }); + expect(result).to.equal('laytpl
'); + }); + + it('escape result', function () { + var result = laytpl('{{= d.name }}
').render({ + name: 'laytpl' + }); + expect(result).to.equal('<em>laytpl</em>
'); + }); + + describe('typeof result', function () { + it('string', function () { + expect(laytpl('{{ d.name }}').render({ + name: 1 + })).to.be.a('string'); + + expect(laytpl([ + '{{# ', + ' if (true) {', + ' return "1";', + ' }', + '}}' + ].join('')).render({})).to.be.a('string'); + }); + + // 表达式返回boolean + it('boolean', function () { + expect(laytpl([ + '{{# ', + ' if (true) {', + ' return true;', + ' }', + '}}' + ].join('')).render({})).to.be.a('boolean'); + }); + + it('number', function () { + expect(laytpl([ + '{{# ', + ' if (true) {', + ' return 1;', + ' }', + '}}' + ].join('')).render({})).to.be.a('number'); + }); + }); + + describe('method config', function () { + // reset + afterEach(function () { + laytpl.config({ + open: '{{', + close: '}}' + }); + }); + + it('typeof', function () { + expect(laytpl.config).to.be.a('function'); + }); + + it('param is empty', function () { + expect(laytpl.config()).to.be.undefined; + }); + + it('set open', function () { + laytpl.config({ + open: '<%' + }); + + var result = laytpl([ + '<%# var name = "laytpl"; }}', + '你好, <% name }}, <% d.date }}' + ].join('')).render({ + date: '2017' + }); + expect(result).to.equal('你好, laytpl, 2017'); + }); + + it('set open and close', function () { + laytpl.config({ + open: '<%', + close: '%>' + }); + + var result = laytpl([ + '<%# var name = "laytpl"; %>', + '你好, <% name %>, <% d.date %>' + ].join('')).render({ + date: '2017' + }); + expect(result).to.equal('你好, laytpl, 2017'); + }); + }); + + describe('js expression', function () { + it('var', function () { + var result = laytpl('{{# var type = 1; }}{{ type }}{{ d.name }}').render({ + name: 2 + }); + expect(result).to.equal('12'); + }); + + it('function', function () { + var result = laytpl('{{# var fn = function () {return "ok"}; }}{{ fn() }}').render({}); + expect(result).to.equal('ok'); + }); + + it('for', function () { + var result = laytpl([ + '{{# ', + ' var fn = function () {', + ' var num = 0;', + ' for (var i = 0; i < 10;i++) {', + ' num += 1;', + ' }', + ' return num', + ' };', + '}}', + '{{# ', + ' var name = "laytpl";', + '}}', + '你好, {{ name }}, {{ d.name }}, {{ fn() }}' + ].join('')).render({ + name: 'ok' + }); + expect(result).to.equal('你好, laytpl, ok, 10'); + }); + + it('if else', function () { + var result; + result = laytpl([ + '{{# ', + ' if (true) {', + ' return true;', + ' }', + ' else {', + ' return false', + ' }', + '}}' + ].join('')).render({}); + expect(result).to.be.true; + + result = laytpl([ + '{{# ', + ' if (!true) {', + ' return true;', + ' }', + ' else {', + ' return false', + ' }', + '}}' + ].join('')).render({}); + expect(result).to.be.false; + }); + }); + + describe('parse error', function () { + it('error var', function () { + var result = laytpl('{{ data.xxoo }}').render({}); + + expect(result).to.have.string('Can\'t find variable: data'); + expect(result).to.have.string('Laytpl Error'); + }); + + it('error expression', function () { + var result = laytpl('{{# var xxoo = ; }}').render({}); + + expect(result).to.have.string('Laytpl Error'); + expect(result).to.have.string('Unexpected token \';\''); + }); + }); +}); From 669a6aeab446aef81d07b95cf9d6716825224833 Mon Sep 17 00:00:00 2001 From: xuexb Date: Wed, 23 Aug 2017 13:37:04 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E6=B7=BB=E5=8A=A0travis=E5=92=8Csaucelab?= =?UTF-8?q?s=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 12 ++++ karma.conf.js => karma.conf.base.js | 4 +- karma.conf.sauce.js | 106 ++++++++++++++++++++++++++++ karma.conf.unit.js | 14 ++++ package.json | 4 +- 5 files changed, 137 insertions(+), 3 deletions(-) create mode 100644 .travis.yml rename karma.conf.js => karma.conf.base.js (99%) create mode 100644 karma.conf.sauce.js create mode 100644 karma.conf.unit.js diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..6f3ec51e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: node_js +node_js: + - node +sudo: false +cache: + directories: + - node_modules +script: + - npm run test:cov + - npm run test:sauce +after_script: + - npm install coveralls && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage \ No newline at end of file diff --git a/karma.conf.js b/karma.conf.base.js similarity index 99% rename from karma.conf.js rename to karma.conf.base.js index 25709a18..3ae0cf17 100644 --- a/karma.conf.js +++ b/karma.conf.base.js @@ -43,7 +43,7 @@ sourceFileMap.filter(function (uri) { }); module.exports = function(config) { - config.set({ + return { // base path that will be used to resolve all patterns (eg. files, exclude) basePath: '', @@ -122,5 +122,5 @@ module.exports = function(config) { // if true, Karma captures browsers, runs the tests and exits // 脚本调用请设为 true singleRun: true - }); + }; }; \ No newline at end of file diff --git a/karma.conf.sauce.js b/karma.conf.sauce.js new file mode 100644 index 00000000..52507ad6 --- /dev/null +++ b/karma.conf.sauce.js @@ -0,0 +1,106 @@ +/** + * @file karma配置 + * @author fe.xiaowu@gmail.com + */ + +var base = require('./karma.conf.base.js'); + +var customLaunchers = { + // Safari + sl_ios_safari: { + base: 'SauceLabs', + browserName: 'Safari' + }, + + // 安卓浏览器 + sl_android_4_4: { + base: 'SauceLabs', + browserName: 'android', + version: '4.4' + }, + sl_android_5: { + base: 'SauceLabs', + browserName: 'android', + version: '5' + }, + sl_android_6: { + base: 'SauceLabs', + browserName: 'android', + version: '6' + }, + + // chrome + sl_ios_chrome: { + base: 'SauceLabs', + browserName: 'chrome' + }, + + sl_ie_8: { + base: 'SauceLabs', + browserName: 'internet explorer', + platform: 'Windows 7', + version: '8' + }, + sl_ie_9: { + base: 'SauceLabs', + browserName: 'internet explorer', + platform: 'Windows 7', + version: '9' + }, + sl_ie_10: { + base: 'SauceLabs', + browserName: 'internet explorer', + platform: 'Windows 8', + version: '10' + }, + sl_ie_11: { + base: 'SauceLabs', + browserName: 'internet explorer', + platform: 'Windows 8.1', + version: '11' + }, + + sl_firefox: { + base: 'SauceLabs', + browserName: 'firefox', + platform: 'Windows 7' + } +}; + +// 不支持本地运行 +if (!process.env.TRAVIS) { + console.error('不支持本地运行, 请使用 npm run test!'); + process.exit(1); +} + +// 变量检查 +if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) { + console.error('---------------'); + console.error('Make sure the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are set.'); + console.error('---------------'); + process.exit(1); +} + +module.exports = function (config) { + var options = Object.assign(base(config), { + reporters: ['mocha', 'saucelabs'], + sauceLabs: { + 'testName': 'layui test case', + 'recordVideo': false, + 'recordScreenshots': false, + 'startConnect': false, + 'connectOptions': { + 'no-ssl-bump-domains': 'all' + }, + 'public': 'public', + 'build': process.env.CIRCLE_BUILD_NUM || process.env.SAUCE_BUILD_ID || 'build-' + Date.now(), + 'tunnelIdentifier': process.env.TRAVIS_JOB_NUMBER + }, + customLaunchers: customLaunchers, + browsers: Object.keys(customLaunchers), + captureTimeout: 1000 * 60 * 5, + browserNoActivityTimeout: 1000 * 60 * 5 + }); + + config.set(options); +}; diff --git a/karma.conf.unit.js b/karma.conf.unit.js new file mode 100644 index 00000000..7d3fd56c --- /dev/null +++ b/karma.conf.unit.js @@ -0,0 +1,14 @@ +/** + * @file karma配置 + * @author fe.xiaowu@gmail.com + */ + +const base = require('./karma.conf.base.js'); + +module.exports = function(config) { + const options = Object.assign(base(config), { + + }); + + config.set(options); +}; \ No newline at end of file diff --git a/package.json b/package.json index 068b6ade..62fbfffe 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,9 @@ "main": "layui.js", "license": "MIT", "scripts": { - "test": "karma start karma.conf.js", + "test": "karma start karma.conf.unit.js", "test:cov": "npm test -- --reporters mocha,coverage", + "test:sauce": "karma start karma.conf.sauce.js", "test:watch": "npm test -- --auto-watch --no-single-run" }, "repository": { @@ -32,6 +33,7 @@ "karma-chai-sinon": "^0.1.5", "karma-coverage": "^1.1.1", "karma-mocha": "^1.3.0", + "karma-sauce-launcher": "^1.1.0", "karma-mocha-reporter": "^2.2.3", "karma-phantomjs-launcher": "^1.0.4", "mocha": "^3.2.0", From 1dda85484d5ea569fdf920c40add8fa5111787a2 Mon Sep 17 00:00:00 2001 From: xuexb Date: Wed, 23 Aug 2017 13:48:39 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9ie8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- karma.conf.sauce.js | 1 - 1 file changed, 1 deletion(-) diff --git a/karma.conf.sauce.js b/karma.conf.sauce.js index 52507ad6..4cd95698 100644 --- a/karma.conf.sauce.js +++ b/karma.conf.sauce.js @@ -38,7 +38,6 @@ var customLaunchers = { sl_ie_8: { base: 'SauceLabs', browserName: 'internet explorer', - platform: 'Windows 7', version: '8' }, sl_ie_9: { From f6f7411f919ffe57059a5afe86a46bb0bcf14fb0 Mon Sep 17 00:00:00 2001 From: xuexb Date: Wed, 23 Aug 2017 13:55:23 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- karma.conf.unit.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/karma.conf.unit.js b/karma.conf.unit.js index 7d3fd56c..3fe64bde 100644 --- a/karma.conf.unit.js +++ b/karma.conf.unit.js @@ -3,12 +3,10 @@ * @author fe.xiaowu@gmail.com */ -const base = require('./karma.conf.base.js'); +var base = require('./karma.conf.base.js'); module.exports = function(config) { - const options = Object.assign(base(config), { - - }); + var options = Object.assign(base(config), {}); config.set(options); }; \ No newline at end of file From b367b37945d5c4daedb3da7713176eca59ed4517 Mon Sep 17 00:00:00 2001 From: xuexb Date: Wed, 23 Aug 2017 14:00:09 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- karma.conf.base.js | 7 +++---- karma.conf.unit.js | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/karma.conf.base.js b/karma.conf.base.js index 3ae0cf17..42e4d9aa 100644 --- a/karma.conf.base.js +++ b/karma.conf.base.js @@ -27,7 +27,7 @@ var sourceFileMap = [ 'src/lay/modules/util.js', 'src/lay/modules/mobile/zepto.js', 'src/lay/modules/mobile/layer-mobile.js', - 'src/lay/modules/mobile/upload-mobile.js', + 'src/lay/modules/mobile/upload-mobile.js' ]; /** @@ -42,9 +42,8 @@ sourceFileMap.filter(function (uri) { coverageFileMap[uri] = ['coverage']; }); -module.exports = function(config) { +module.exports = function (config) { return { - // base path that will be used to resolve all patterns (eg. files, exclude) basePath: '', @@ -123,4 +122,4 @@ module.exports = function(config) { // 脚本调用请设为 true singleRun: true }; -}; \ No newline at end of file +}; diff --git a/karma.conf.unit.js b/karma.conf.unit.js index 3fe64bde..724a5576 100644 --- a/karma.conf.unit.js +++ b/karma.conf.unit.js @@ -5,8 +5,8 @@ var base = require('./karma.conf.base.js'); -module.exports = function(config) { +module.exports = function (config) { var options = Object.assign(base(config), {}); config.set(options); -}; \ No newline at end of file +}; From ad17cdfae109f90b579ecde1af5c18a4506551ab Mon Sep 17 00:00:00 2001 From: xuexb Date: Wed, 23 Aug 2017 14:05:59 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20saucelabs=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 6f3ec51e..db2914de 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,11 @@ language: node_js +dist: trusty +addons: + chrome: stable node_js: - node +addons: + sauce_connect: true sudo: false cache: directories: From 9d4a55f65029599e0e032b4c15f00e978686607d Mon Sep 17 00:00:00 2001 From: xuexb Date: Wed, 23 Aug 2017 17:43:35 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E5=85=88=E5=85=B3=E9=97=AD=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E5=99=A8=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index db2914de..18d619a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,6 @@ cache: - node_modules script: - npm run test:cov - - npm run test:sauce + #- npm run test:sauce after_script: - npm install coveralls && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage \ No newline at end of file From 6e2e028a64022cf65d5bafedb8f0d6168de82168 Mon Sep 17 00:00:00 2001 From: xuexb Date: Wed, 23 Aug 2017 17:47:46 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E5=85=88=E5=85=B3=E9=97=AD=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E5=99=A8=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 18d619a7..249cc3ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,8 @@ addons: chrome: stable node_js: - node -addons: - sauce_connect: true +#addons: +# sauce_connect: true sudo: false cache: directories: