-
Notifications
You must be signed in to change notification settings - Fork 1
/
karma-ci.config.js
119 lines (99 loc) · 3.28 KB
/
karma-ci.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
var fs = require('fs');
var _ = require("lodash");
var webpack = require('webpack');
var webpackConfig = require("./webpack.config.js");
// prepare webpack config for unit tests
var webpackTestConfig = _.merge({}, webpackConfig, {
devtool: 'inline-source-map',
module: {
postLoaders: [
{
test: /\.ts$/,
loader: 'istanbul-instrumenter'
}
]
}
});
//
// Use ENV vars on Travis and sauce.json locally to get credentials
if (!process.env.SAUCE_USERNAME) {
if (!fs.existsSync('sauce.json')) {
console.log('Create a sauce.json with your credentials based on the sauce-sample.json file.');
process.exit(1);
} else {
process.env.SAUCE_USERNAME = require('./sauce').username;
process.env.SAUCE_ACCESS_KEY = require('./sauce').accessKey;
}
}
// Browsers to run on Sauce Labs
var customLaunchers = {
'SL_Chrome': {
base: 'SauceLabs',
browserName: 'chrome'
},
'SL_InternetExplorer': {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '10'
}
//'SL_FireFox': {
// base: 'SauceLabs',
// browserName: 'firefox',
// version: '45'
//}
};
module.exports = function(config) {
config.set({
basePath: '.',
frameworks: ['jasmine', 'jasmine-matchers'],
files: [
'./node_modules/angular/angular.js',
'./node_modules/angular-mocks/angular-mocks.js',
'./node_modules/angular-animate/angular-animate.js',
'./node_modules/angular-aria/angular-aria.js',
'./node_modules/angular-messages/angular-messages.js',
'./node_modules/angular-material/angular-material.js',
'./node_modules/angular-sanitize/angular-sanitize.js',
'./node_modules/rx/dist/rx.js',
'./node_modules/rx-angular/dist/rx.angular.js',
// unit test main entry
'test/unit/test_index.js'
],
preprocessors: {
'test/unit/test_index.js': ['webpack']
},
logLevel: config.LOG_INFO,
webpack: webpackTestConfig,
webpackMiddleware: {
noInfo: true
},
reporters: ['dots', 'saucelabs', 'nested', 'coverage', 'threshold', 'coveralls'],
coverageReporter: {
dir: 'build/reports/coverage',
reporters: [
// reporters not supporting the `file` property
{ type: 'html', subdir: 'report-html' },
{ type: 'lcov', subdir: 'report-lcov' },
{ type: 'cobertura', subdir: '.', file: 'cobertura.txt' },
{ type: 'lcovonly', subdir: '.', file: 'report-lcovonly.txt' },
{ type: 'text', subdir: '.', file: 'text.txt' },
{ type: 'text-summary', subdir: '.', file: 'text-summary.txt' },
]
},
thresholdReporter: {
statements: 48, // 90
branches: 26, // 60
functions: 27, // 85
lines: 47 // 90
},
sauceLabs: {
testName: process.env.CIRCLE_PROJECT_USERNAME + '/' + process.env.CIRCLE_PROJECT_REPONAME + (process.env.CIRCLE_BRANCH ? '/' + process.env.CIRCLE_BRANCH : '') + (process.env.CIRCLE_TAG ? '/' + process.env.CIRCLE_TAG : '') + (process.env.CIRCLE_BUILD_NUM ? '/build_' + process.env.CIRCLE_BUILD_NUM : '')
},
captureTimeout: 120000,
customLaunchers: customLaunchers,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: Object.keys(customLaunchers),
singleRun: true
});
};