@@ -4,10 +4,15 @@ var path = require('path');
4
4
var minimist = require ( 'minimist' ) ;
5
5
var constants = require ( '../../tasks/util/constants' ) ;
6
6
7
- var isCI = ! ! process . env . CI ;
7
+ var isCI = Boolean ( process . env . CI ) ;
8
+
8
9
var argv = minimist ( process . argv . slice ( 4 ) , {
9
10
string : [ 'bundleTest' , 'width' , 'height' ] ,
10
- 'boolean' : [ 'info' , 'nowatch' , 'failFast' , 'verbose' , 'Chrome' , 'Firefox' , 'IE11' ] ,
11
+ 'boolean' : [
12
+ 'info' ,
13
+ 'nowatch' , 'failFast' , 'verbose' , 'randomize' ,
14
+ 'Chrome' , 'Firefox' , 'IE11'
15
+ ] ,
11
16
alias : {
12
17
'Chrome' : 'chrome' ,
13
18
'Firefox' : [ 'firefox' , 'FF' ] ,
@@ -21,6 +26,7 @@ var argv = minimist(process.argv.slice(4), {
21
26
nowatch : isCI ,
22
27
failFast : false ,
23
28
verbose : false ,
29
+ randomize : false ,
24
30
width : '1035' ,
25
31
height : '617'
26
32
}
@@ -60,6 +66,7 @@ if(argv.info) {
60
66
' - `--failFast` (dflt: `false`): exit karma upon first test failure' ,
61
67
' - `--verbose` (dflt: `false`): show test result using verbose reporter' ,
62
68
' - `--showSkipped` (dflt: `false`): show tests that are skipped' ,
69
+ ' - `--randomize` (dflt: `false`): randomize test ordering (useful to detect bad test teardown)' ,
63
70
' - `--tags`: run only test with given tags (using the `jasmine-spec-tags` framework)' ,
64
71
' - `--width`(dflt: 1035): set width of the browser window' ,
65
72
' - `--height` (dflt: 617): set height of the browser window' ,
@@ -113,7 +120,6 @@ var pathToUnpolyfill = path.join(__dirname, 'assets', 'unpolyfill.js');
113
120
var pathToMathJax = path . join ( constants . pathToDist , 'extras' , 'mathjax' ) ;
114
121
115
122
var reporters = ( ( isFullSuite && ! argv . tags ) || argv . showSkipped ) ? [ 'dots' , 'spec' ] : [ 'progress' ] ;
116
- if ( argv . failFast ) reporters . push ( 'fail-fast' ) ;
117
123
if ( argv . verbose ) reporters . push ( 'verbose' ) ;
118
124
119
125
function func ( config ) {
@@ -224,27 +230,33 @@ func.defaultConfig = {
224
230
debug : true
225
231
} ,
226
232
227
- // Options for `karma-jasmine-spec-tags`
228
- // see https://www.npmjs.com/package/karma-jasmine-spec-tags
229
- //
230
- // A few tests don't behave well on CI
231
- // add @noCI to the spec description to skip a spec on CI
232
- //
233
- // Although not recommended, some tests "depend" on other
234
- // tests to pass (e.g. the Plotly.react tests check that
235
- // all available traces and transforms are tested). Tag these
236
- // with @noCIdep , so that
237
- // - $ npm run test-jasmine -- tags=noCI,noCIdep
238
- // can pass.
239
- //
240
- // Label tests that require a WebGL-context by @gl so that
241
- // they can be skipped using:
242
- // - $ npm run test-jasmine -- --skip-tags=gl
243
- // or run is isolation easily using:
244
- // - $ npm run test-jasmine -- --tags=gl
245
233
client : {
234
+ // Options for `karma-jasmine-spec-tags`
235
+ // see https://www.npmjs.com/package/karma-jasmine-spec-tags
236
+ //
237
+ // A few tests don't behave well on CI
238
+ // add @noCI to the spec description to skip a spec on CI
239
+ //
240
+ // Although not recommended, some tests "depend" on other
241
+ // tests to pass (e.g. the Plotly.react tests check that
242
+ // all available traces and transforms are tested). Tag these
243
+ // with @noCIdep , so that
244
+ // - $ npm run test-jasmine -- tags=noCI,noCIdep
245
+ // can pass.
246
+ //
247
+ // Label tests that require a WebGL-context by @gl so that
248
+ // they can be skipped using:
249
+ // - $ npm run test-jasmine -- --skip-tags=gl
250
+ // or run is isolation easily using:
251
+ // - $ npm run test-jasmine -- --tags=gl
246
252
tagPrefix : '@' ,
247
- skipTags : isCI ? 'noCI' : null
253
+ skipTags : isCI ? 'noCI' : null ,
254
+
255
+ // See https://jasmine.github.io/api/3.4/Configuration.html
256
+ jasmine : {
257
+ random : argv . randomize ,
258
+ failFast : argv . failFast
259
+ }
248
260
} ,
249
261
250
262
// use 'karma-spec-reporter' to log info about skipped specs
@@ -253,14 +265,8 @@ func.defaultConfig = {
253
265
suppressFailed : true ,
254
266
suppressPassed : true ,
255
267
suppressSkipped : false ,
256
- showSpecTiming : false ,
257
- // use 'karma-fail-fast-reporter' to fail fast w/o conflicting
258
- // with other karma plugins
259
- failFast : false
260
- } ,
261
-
262
- // e.g. when a test file does not container a given spec tags
263
- failOnEmptyTestSuite : false
268
+ showSpecTiming : false
269
+ }
264
270
} ;
265
271
266
272
func . defaultConfig . preprocessors [ pathToCustomMatchers ] = [ 'browserify' ] ;
0 commit comments