-
Notifications
You must be signed in to change notification settings - Fork 1
/
karma.conf.js
153 lines (120 loc) · 3.01 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/* global process */
// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html
'use strict';
var path = require( 'path' );
module.exports = function( config ) {
var projectFiles = require( './project-files' );
// var configFiles = [].concat(
// projectFiles.components.main,
// projectFiles.build.scripts,
// projectFiles.build.tests
// );
var configFiles = [].concat(
'node_modules/karma-babel-preprocessor/node_modules/babel-core/browser-polyfill.js',
projectFiles.polyfills,
projectFiles.components.main,
'src/modules/**/*.js',
'src/tests/**/*.js'
);
var configuration = {
// base path, that will be used to resolve files and exclude
basePath: '',
// plugins: [
// 'karma-chrome-launcher',
// 'karma-jasmine',
// 'karma-mocha-reporter'
// ],
// testing framework to use (jasmine/mocha/qunit/...)
frameworks: [
'jasmine'
// 'phantomjs-shim'
],
reporters: [
'mocha',
'growl',
'coverage'
],
customPreprocessors: {
babel_with_modules: {
base: 'babel',
options: {
modules: 'system',
moduleIds: true,
moduleRoot: ''
}
},
babel_no_modules: {
base: 'babel',
options: {
modules: 'ignore'
}
}
},
preprocessors: {
'src/modules/**/*': [ 'babel_with_modules' ],
'src/tests/**/*': [ 'babel_no_modules' ]
},
babelPreprocessor: {
options: {
optional: [ 'es7.asyncFunctions' ],
sourceRoot: process.cwd()
}
},
mochaReporter: {
output: 'autowatch'
},
coverageReporter: {
type: 'html',
dir: 'coverage/',
subdir: '.'
},
// list of files / patterns to load in the browser
files: configFiles,
// web server port
port: 8000,
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel: config.LOG_WARN,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: [
// 'Chrome_hidden'
// 'Firefox'
'PhantomJS2'
],
customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: [ '--no-sandbox' ]
},
Chrome_hidden: {
base: 'ChromeCanary',
flags: [ '--window-position=99999,99999', '--window-size=200,200' ]
}
},
// Timeout after 10 seconds
captureTimeout: 10000,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: true
};
if ( process.env.TRAVIS ) {
configuration.browsers = [
'Chrome_travis_ci',
'Firefox'
];
configuration.reporters = [
'mocha'
];
}
config.set( configuration );
};