mirror of https://github.com/layui/layui
贤心
3 years ago
4 changed files with 0 additions and 318 deletions
@ -1,19 +0,0 @@
|
||||
language: node_js |
||||
node_js: |
||||
- node |
||||
dist: trusty |
||||
addons: |
||||
sauce_connect: |
||||
username: layui |
||||
jwt: |
||||
secure: "c+I/AGPj+9cdZOtwGv9eFBdFNlo/BtSEnZ/mGXBLM2+FUn8Dptvhqy1XalRBul3sNiCyv2lNtcZPGw0kirI4EjGiXFfqghq9psvwOchkNM+bFxAiH+uRYCVb1ouDbpAh0w4d/nxpB11fPdVNzudwbiI/ii8LNm1sDDnJOklHiuzWBgOVN2jkzNRapacLfto6bWjnyS4r/zElLwnKpXlN6cIJFzYBU1f/RS68xaHwr/9+wvf5gNzL7OmmiIxl+UJJMejoK3G7I6DTiXyosJxsnljSxG0zbDSDL9lzPeQjFClya25ubbCFPv/UADlVAlz5Y4SLIaTUaRWD7tVphpku5S9XBwIopRQBdtp6y1Ebh/F7pDAiuN8lHzvkr6z++ld9nVcSJppSWN/tyibN7b+C7m6TyreVMHFjw+egAbd3wPVgrD30Vswu9vQXyVydcRJiP295VclgaHobdZKEwrqK7mujsOVOlZEoZWm2B+MLGfvYIjhVdpcRGlAZN+VvA+ea93t/poY1LB1/qH0vF2jMNa3ZI6AWrZaaTbToMUEj6QB9tnOGnGvINOGJDamMMB6aeCLaEgZzRqvTYXgzJAi1kYQKkCL//v3Z6od5eDBUVgMEOkTIchPjSDX5lwMedroPwnFql9ArIWnm7mLHQToEArOoKQhSlFOx+sA/nortCL4=" |
||||
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 |
||||
|
@ -1,178 +0,0 @@
|
||||
/** |
||||
* @file karma自动化测试配置 |
||||
* @author fe.xiaowu@gmail.com |
||||
*/ |
||||
|
||||
var url = require('url'); |
||||
|
||||
/** |
||||
* mock一个server供测试使用 |
||||
* |
||||
* @param {Object} req request |
||||
* @param {Object} res response |
||||
* @param {Function} next 下一路由 |
||||
* |
||||
* @example |
||||
* 请求 /api/mock 参数如: |
||||
* timeout - 超时时间, 默认 0 |
||||
* statusCode - 状态码, 默认 200 |
||||
* response - 响应内容, 默认 {} |
||||
* dataType - 响应格式, 默认 json |
||||
*/ |
||||
var httpServer = function (req, res, next) { |
||||
if (req.url.indexOf('/api/mock') === -1) { |
||||
return next(); |
||||
} |
||||
|
||||
var data = url.parse(req.url, true).query; |
||||
|
||||
setTimeout(function () { |
||||
res.statusCode = data.statusCode || 200; |
||||
res.setHeader('content-type', data.contentType || 'json'); |
||||
res.end(data.response || '{}'); |
||||
}, data.timeout || 0); |
||||
}; |
||||
|
||||
/** |
||||
* 源文件 |
||||
* |
||||
* @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) { |
||||
return { |
||||
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||
basePath: '', |
||||
|
||||
// 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').concat({ |
||||
pattern: 'src/css/**/*', |
||||
included: false |
||||
}, { |
||||
pattern: 'src/font/**/*', |
||||
included: false |
||||
}, { |
||||
pattern: 'src/images/**/*', |
||||
included: false |
||||
}), |
||||
|
||||
|
||||
// list of files to exclude
|
||||
exclude: [], |
||||
|
||||
client: { |
||||
mocha: { |
||||
// mocha测试超时6秒
|
||||
timeout: 1000 * 6 |
||||
} |
||||
}, |
||||
|
||||
|
||||
// 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, |
||||
|
||||
middleware: ['httpServer'], |
||||
|
||||
plugins: ['karma-*', { |
||||
'middleware:httpServer': [ |
||||
'factory', function () { |
||||
return httpServer; |
||||
} |
||||
] |
||||
}] |
||||
}; |
||||
}; |
@ -1,109 +0,0 @@
|
||||
/** |
||||
* @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',
|
||||
// version: '8'
|
||||
// },
|
||||
sl_ie_9: { |
||||
base: 'SauceLabs', |
||||
browserName: 'internet explorer', |
||||
version: '9' |
||||
}, |
||||
sl_ie_10: { |
||||
base: 'SauceLabs', |
||||
browserName: 'internet explorer', |
||||
version: '10' |
||||
}, |
||||
sl_ie_11: { |
||||
base: 'SauceLabs', |
||||
browserName: 'internet explorer', |
||||
version: '11' |
||||
}, |
||||
|
||||
sl_edga: { |
||||
base: 'SauceLabs', |
||||
browserName: 'microsoftedge', |
||||
// platform: 'Windows 10'
|
||||
}, |
||||
|
||||
// sl_firefox: {
|
||||
// base: 'SauceLabs',
|
||||
// browserName: 'firefox'
|
||||
// }
|
||||
}; |
||||
|
||||
// 不支持本地运行
|
||||
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', |
||||
'recordVideo': false, |
||||
'recordScreenshots': false, |
||||
'startConnect': false, |
||||
'connectOptions': { |
||||
'no-ssl-bump-domains': 'all' |
||||
}, |
||||
'public': 'public', |
||||
'build': 'layui-build-' + process.env.TRAVIS_BUILD_NUMBER, |
||||
'tunnelIdentifier': process.env.TRAVIS_JOB_NUMBER |
||||
}, |
||||
customLaunchers: customLaunchers, |
||||
browsers: Object.keys(customLaunchers), |
||||
captureTimeout: 1000 * 60 * 5, |
||||
browserNoActivityTimeout: 1000 * 60 * 5, |
||||
browserDisconnectTolerance: 3, |
||||
browserDisconnectTimeout: 10000 |
||||
}); |
||||
|
||||
config.set(options); |
||||
}; |
Loading…
Reference in new issue