Skip to content

Commit

Permalink
add saucelabs service
Browse files Browse the repository at this point in the history
  • Loading branch information
leolin1229 committed Aug 1, 2016
1 parent 08f4c60 commit 1272938
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 56 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
language: node_js
sudo: true
addons:
sauce_connect:
username: 'leolin'
access_key: '2d69d455-a8ff-45bd-8a93-5ba373ddf6a3'
node_js:
- '4.4.2'
services: mongodb
Expand Down
181 changes: 125 additions & 56 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,86 +2,155 @@
// Generated on Sun Jul 31 2016 18:14:21 GMT+0800 (CST)

module.exports = function(config) {
config.set({
var customLaunchers = {
// the cool kids
sl_chrome: {
base: 'SauceLabs',
browserName: 'chrome',
platform: 'Windows 7'
},
sl_firefox: {
base: 'SauceLabs',
browserName: 'firefox'
},
sl_mac_safari: {
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.10'
},
// ie family
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'
},
// mobile
sl_ios_safari: {
base: 'SauceLabs',
browserName: 'iphone',
platform: 'OS X 10.9',
version: '8.1'
},
sl_android: {
base: 'SauceLabs',
browserName: 'android',
platform: 'Linux',
version: '4.2'
}
};

if (!process.env.SAUCE_USERNAME) {
process.env.SAUCE_USERNAME = 'leolin';
process.env.SAUCE_ACCESS_KEY = '2d69d455-a8ff-45bd-8a93-5ba373ddf6a3';
}

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
config.set({

client: {
mocha: {
timeout: 6000
}
},
// 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: ['mocha', 'chai'],
client: {
mocha: {
timeout: 6000
}
},

// mobile emulators are really slow
captureTimeout: 300000,
browserNoActivityTimeout: 300000,

// list of files / patterns to load in the browser
files: [
'test/**/*.test.js'
],
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'chai'],


// list of files to exclude
exclude: [
'**/*.swp'
],
// list of files / patterns to load in the browser
files: [
'test/**/*.test.js'
],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'test/**/*.test.js': ['webpack']
},
// list of files to exclude
exclude: [
'**/*.swp'
],


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['mocha'],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'test/**/*.test.js': ['webpack']
},


// web server port
port: 9876,
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['coverage', 'mocha', 'saucelabs'],


// enable / disable colors in the output (reporters and logs)
colors: true,
// web server port
port: 9876,


// 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 colors in the output (reporters and logs)
colors: true,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
sauceLabs: {
testName: 'bugReport unit tests',
public: 'public'
},

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

customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
}
});
browsers: Object.keys(customLaunchers),

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

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

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

if(process.env.TRAVIS){
config.browsers = ['Chrome_travis_ci'];
}
// if(process.env.TRAVIS){
// config.browsers = ['Chrome_travis_ci'];
// }
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"karma-mocha": "^1.1.1",
"karma-mocha-reporter": "^2.1.0",
"karma-safari-launcher": "^1.0.0",
"karma-sauce-launcher": "^1.0.0",
"karma-webpack": "^1.7.0",
"mocha": "^2.5.3",
"webpack": "^1.13.1"
Expand Down

0 comments on commit 1272938

Please sign in to comment.