@@ -17,6 +17,7 @@ var constants = require('../../tasks/util/constants');
17
17
18
18
var arg = process . argv [ 4 ] ;
19
19
20
+ var isCI = ! ! process . env . CIRCLECI ;
20
21
var testFileGlob = arg ? arg : 'tests/*_test.js' ;
21
22
var isSingleSuiteRun = ( arg && arg . indexOf ( 'bundle_tests/' ) === - 1 ) ;
22
23
var isRequireJSTest = ( arg && arg . indexOf ( 'bundle_tests/requirejs' ) !== - 1 ) ;
@@ -53,13 +54,14 @@ func.defaultConfig = {
53
54
54
55
// frameworks to use
55
56
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
56
- frameworks : [ 'jasmine' , 'browserify' ] ,
57
+ frameworks : [ 'jasmine' , 'jasmine-spec-tags' , ' browserify'] ,
57
58
58
59
// list of files / patterns to load in the browser
59
60
//
60
61
// N.B. this field is filled below
61
62
files : [ ] ,
62
63
64
+ // list of files / pattern to exclude
63
65
exclude : [ ] ,
64
66
65
67
// preprocess matching files before serving them to the browser
@@ -75,7 +77,7 @@ func.defaultConfig = {
75
77
// See note in CONTRIBUTING.md about more verbose reporting via karma-verbose-reporter:
76
78
// https://www.npmjs.com/package/karma-verbose-reporter ('verbose')
77
79
//
78
- reporters : [ 'progress' ] ,
80
+ reporters : isSingleSuiteRun ? [ 'progress' ] : [ 'dots' , 'spec '] ,
79
81
80
82
// web server port
81
83
port : 9876 ,
@@ -84,14 +86,23 @@ func.defaultConfig = {
84
86
colors : true ,
85
87
86
88
// enable / disable watching file and executing tests whenever any file changes
87
- autoWatch : true ,
89
+ autoWatch : ! isCI ,
90
+
91
+ // if true, Karma captures browsers, runs the tests and exits
92
+ singleRun : isCI ,
93
+
94
+ // how long will Karma wait for a message from a browser before disconnecting (30 ms)
95
+ browserNoActivityTimeout : 30000 ,
88
96
89
97
// start these browsers
90
98
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
91
99
browsers : [ 'Chrome_WindowSized' ] ,
92
100
93
101
// custom browser options
102
+ //
94
103
// window-size values came from observing default size
104
+ //
105
+ // '--ignore-gpu-blacklist' allow to test WebGL on CI (!!!)
95
106
customLaunchers : {
96
107
Chrome_WindowSized : {
97
108
base : 'Chrome' ,
@@ -103,58 +114,64 @@ func.defaultConfig = {
103
114
}
104
115
} ,
105
116
106
- // Continuous Integration mode
107
- // if true, Karma captures browsers, runs the tests and exits
108
- singleRun : false ,
109
-
110
117
browserify : {
111
118
transform : [ '../../tasks/util/shortcut_paths.js' ] ,
112
119
extensions : [ '.js' ] ,
113
- watch : true ,
120
+ watch : ! isCI ,
114
121
debug : true
122
+ } ,
123
+
124
+ // unfortunately a few tests don't behave well on CI
125
+ // using `karma-jasmine-spec-tags`
126
+ // add @noCI to the spec description to skip a spec on CI
127
+ client : {
128
+ tagPrefix : '@' ,
129
+ skipTags : isCI ? 'noCI' : null
130
+ } ,
131
+
132
+ // use 'karma-spec-reporter' to log info about skipped specs
133
+ specReporter : {
134
+ suppressErrorSummary : true ,
135
+ suppressFailed : true ,
136
+ suppressPassed : true ,
137
+ suppressSkipped : false ,
138
+ showSpecTiming : false ,
139
+ failFast : false
115
140
}
116
141
} ;
117
142
118
-
119
143
// Add lib/index.js to single-suite runs,
120
144
// to avoid import conflicts due to plotly.js
121
145
// circular dependencies.
122
146
if ( isSingleSuiteRun ) {
123
- func . defaultConfig . files = [
147
+ func . defaultConfig . files . push (
124
148
pathToJQuery ,
125
- pathToMain ,
126
- testFileGlob
127
- ] ;
149
+ pathToMain
150
+ ) ;
128
151
129
152
func . defaultConfig . preprocessors [ pathToMain ] = [ 'browserify' ] ;
130
153
func . defaultConfig . preprocessors [ testFileGlob ] = [ 'browserify' ] ;
131
154
}
132
155
else if ( isRequireJSTest ) {
133
156
func . defaultConfig . files = [
134
157
constants . pathToRequireJS ,
135
- constants . pathToRequireJSFixture ,
136
- testFileGlob
158
+ constants . pathToRequireJSFixture
137
159
] ;
138
160
}
139
161
else if ( isIE9Test ) {
140
162
// load ie9_mock.js before plotly.js+test bundle
141
163
// to catch reference errors that could occur
142
164
// when plotly.js is first loaded.
143
165
144
- func . defaultConfig . files = [
145
- './assets/ie9_mock.js' ,
146
- testFileGlob
147
- ] ;
148
-
166
+ func . defaultConfig . files . push ( './assets/ie9_mock.js' ) ;
149
167
func . defaultConfig . preprocessors [ testFileGlob ] = [ 'browserify' ] ;
150
168
}
151
169
else {
152
- func . defaultConfig . files = [
153
- pathToJQuery ,
154
- testFileGlob
155
- ] ;
156
-
170
+ func . defaultConfig . files . push ( pathToJQuery ) ;
157
171
func . defaultConfig . preprocessors [ testFileGlob ] = [ 'browserify' ] ;
158
172
}
159
173
174
+ // lastly, load test file glob
175
+ func . defaultConfig . files . push ( testFileGlob ) ;
176
+
160
177
module . exports = func ;
0 commit comments