forked from jwplayer/jwplayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
113 lines (98 loc) · 3.81 KB
/
karma.conf.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
/* jshint node: true */
module.exports = function( config ) {
var env = process.env;
var isJenkins = !!process.env.JENKINS_HOME;
var serverPort = process.env.KARMA_PORT || 9876;
var testReporters = [
'progress',
'coverage'
];
if (isJenkins) {
testReporters.push('junit');
}
var packageInfo = JSON.parse(require('fs').readFileSync('package.json', 'utf8'));
config.set({
basePath: '.',
plugins: [
'karma-coverage',
'karma-requirejs',
'karma-qunit',
'karma-junit-reporter',
'karma-phantomjs-launcher',
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-safari-launcher',
'karma-browserstack-launcher'
],
frameworks: ['requirejs', 'qunit'],
reporters: testReporters,
port: serverPort, // web server port
colors: !isJenkins, // colors in the output (reporters and logs)
autoWatch: false, // watch file and execute tests whenever any file changes
singleRun: true, // if true, Karma captures browsers, runs the tests and exits
client: {
useIframe: false // use a new window for each test
},
// Possible values:
// config.LOG_DISABLE
// config.LOG_ERROR
// config.LOG_WARN
// config.LOG_INFO
// config.LOG_DEBUG
logLevel: config.LOG_INFO,
browsers: [
'PhantomJS',
'Chrome',
//'Safari', // experiencing issues with [email protected] and Safari 9.1.1
'Firefox'
],
customLaunchers: require( './test/karma/browserstack-launchers' ),
browserStack: {
username: env.BS_USERNAME,
accessKey: env.BS_AUTHKEY,
name: 'Unit Tests',
project: 'jwplayer',
build: '' + (env.JOB_NAME || 'local' ) +' '+
(env.BUILD_NUMBER || env.USER) +' '+
(env.GIT_BRANCH || '' ) +' '+
packageInfo.version,
timeout: 300 // 5 minutes
},
// to avoid DISCONNECTED messages when connecting to BrowserStack
browserDisconnectTimeout : 20 * 1000, // default 2000
browserDisconnectTolerance : 1, // default 0
browserNoActivityTimeout : 100 * 1000, //default 10000
captureTimeout : 120 * 1000, //default 60000
files : [
//3rd Party Code
{pattern: 'bower_components/requirejs/require.js', included: true},
{pattern: 'bower_components/**/*.js', included: false},
{pattern: 'node_modules/simple-style-loader/addStyles.js', included: false},
// Require Config
{pattern: 'test/config.js', included: true},
// Source
{pattern: 'src/js/**/*.js', included: false},
{pattern: 'src/css/**/*.less', included: false},
{pattern: 'src/templates/**/*.html', included: false},
// Tests
{pattern: 'test/data/*.js', included: false},
{pattern: 'test/data/*.json', included: false},
{pattern: 'test/data/*.xml', included: false},
{pattern: 'test/mock/*.js', included: false},
{pattern: 'test/unit/*.js', included: false},
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
// source files, that you want to generate coverage for
'src/js/*.js': ['coverage'],
'src/js/!(polyfill)/*.js': ['coverage']
},
coverageReporter: {
type: 'html',
dir: 'reports/coverage'
},
// number of browsers to run at once
concurrency: Infinity
});
};