Skip to content

Commit

Permalink
blear.utils.compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudcome committed May 21, 2016
1 parent 65c7f78 commit 3c04055
Show file tree
Hide file tree
Showing 7 changed files with 188 additions and 160 deletions.
1 change: 1 addition & 0 deletions .coveralls.yml
@@ -0,0 +1 @@
repo_token: 5oaByIGLTXskkkwvka0EkcaERYYc64HQR
7 changes: 3 additions & 4 deletions .travis.yml
@@ -1,8 +1,7 @@
language: node_js
node_js:
- 4.0
before_script:
before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
script:
- npm test
- sh -e /etc/init.d/xvfb start
1 change: 0 additions & 1 deletion karma.conf-cover.js

This file was deleted.

166 changes: 165 additions & 1 deletion karma.conf.js
@@ -1 +1,165 @@
module.exports = require('./karma.config-gen.js')();
/**
* karma 测试配置文件
* @author ydr.me
* @create 2016-04-20 21:15
*/


'use strict';


var TRAVIS = process.env.TRAVIS;

// http 服务器
var httpServer = function (req, res, next) {
next();
};


module.exports = function (config) {
var browsers = [];
var reporters = ['progress', 'coverage'];
var coverageReporters = [{
type: 'text-summary'
}];

if (TRAVIS) {
browsers = ['Chrome_travis_ci'];
reporters.push('coveralls');
coverageReporters.push({
type: 'lcov',
dir: './coverage/'
});
} else {
browsers = ['Chrome'];
}


config.set({

// 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
// 单元测试框架
frameworks: ['jasmine', 'coolie'],


client: {},


// list of files / patterns to load in the browser
files: [
{
// 加载 src 下的原始文件,但不直接引入,使用模块加载器引入
pattern: './src/**',
included: false
},
{
// 加载 node_modules 下的原始文件,但不直接引入,使用模块加载器引入
pattern: './node_modules/blear.*/package.json',
included: false
},
{
// 加载 node_modules 下的原始文件,但不直接引入,使用模块加载器引入
pattern: './node_modules/blear.*/src/**',
included: false
},
{
// 加载 src 下的原始文件,但不直接引入,使用模块加载器引入
pattern: './test/test.**',
included: false
},
{
// 加载 test 下的入口文件,但不直接引入,使用模块加载器引入
pattern: './test/main.js',
included: true
}
],


// list of files to exclude
include: [],
exclude: [],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
// 原始模块,需要测试覆盖率
'./src/index.js': ['coverage']
},


// optionally, configure the reporter
// 覆盖率报告
coverageReporter: {
reporters: coverageReporters
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
// 报告类型
reporters: reporters,


// 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
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: browsers,


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,


// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity,


customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
},


middleware: ['httpServer'],


// plugins
plugins: ['karma-*', {
'middleware:httpServer': [
'factory', function () {
return httpServer;
}
]
}]
});
};



146 changes: 0 additions & 146 deletions karma.config-gen.js

This file was deleted.

15 changes: 9 additions & 6 deletions package.json
@@ -1,10 +1,11 @@
{
"name": "blear.utils.compatible",
"version": "1.0.0",
"version": "1.0.1",
"description": "浏览器兼容性",
"scripts": {
"live": "browser-sync start --config bs-config.js",
"test": "node ./node_modules/.bin/karma start --single-run --browsers PhantomJS --reporters progress"
"test": "node ./node_modules/.bin/karma start karma.conf.js --single-run",
"prepublish": "npm test"
},
"preferGlobal": false,
"bin": {},
Expand All @@ -14,6 +15,9 @@
},
"main": "src/index.js",
"keywords": [
"blear",
"utils",
"compatibe",
"cloudcome",
"ydr.me"
],
Expand All @@ -39,12 +43,11 @@
"devDependencies": {
"jasmine-core": "^2.4.1",
"karma": "^0.13.22",
"karma-coolie": "2.x",
"karma-chrome-launcher": "^1.0.1",
"karma-coolie": "^2.0.1",
"karma-coverage": "^0.5.5",
"karma-coveralls": "^1.1.2",
"karma-jasmine": "^0.3.8",
"karma-phantomjs-launcher": "^1.0.0",
"phantomjs-prebuilt": "^2.1.7"
"karma-jasmine": "^0.3.8"
},
"license": "MIT"
}
12 changes: 10 additions & 2 deletions readme.md
@@ -1,7 +1,15 @@
# blear.utils.compatible

[![Build Status][travis-img]][travis-url]
[![npm module][npm-img]][npm-url]
[![build status][travis-img]][travis-url]
[![coverage][coveralls-img]][coveralls-url]

[travis-img]: https://travis-ci.org/blearjs/blear.utils.compatible.svg?branch=master
[travis-img]: https://img.shields.io/travis/blearjs/blear.utils.compatible/master.svg?maxAge=2592000&style=flat-square
[travis-url]: https://travis-ci.org/blearjs/blear.utils.compatible

[npm-img]: https://img.shields.io/npm/v/blear.utils.compatible.svg?maxAge=2592000&style=flat-square
[npm-url]: https://www.npmjs.com/package/blear.utils.compatible

[coveralls-img]: https://img.shields.io/coveralls/blearjs/blear.utils.compatible/master.svg?maxAge=2592000&style=flat-square
[coveralls-url]: https://coveralls.io/github/blearjs/blear.utils.compatible?branch=master

0 comments on commit 3c04055

Please sign in to comment.