@@ -4,10 +4,15 @@ var path = require('path');
44var minimist = require ( 'minimist' ) ;
55var constants = require ( '../../tasks/util/constants' ) ;
66
7- var isCI = ! ! process . env . CI ;
7+ var isCI = Boolean ( process . env . CI ) ;
8+
89var argv = minimist ( process . argv . slice ( 4 ) , {
910 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+ ] ,
1116 alias : {
1217 'Chrome' : 'chrome' ,
1318 'Firefox' : [ 'firefox' , 'FF' ] ,
@@ -21,6 +26,7 @@ var argv = minimist(process.argv.slice(4), {
2126 nowatch : isCI ,
2227 failFast : false ,
2328 verbose : false ,
29+ randomize : false ,
2430 width : '1035' ,
2531 height : '617'
2632 }
@@ -60,6 +66,7 @@ if(argv.info) {
6066 ' - `--failFast` (dflt: `false`): exit karma upon first test failure' ,
6167 ' - `--verbose` (dflt: `false`): show test result using verbose reporter' ,
6268 ' - `--showSkipped` (dflt: `false`): show tests that are skipped' ,
69+ ' - `--randomize` (dflt: `false`): randomize test ordering (useful to detect bad test teardown)' ,
6370 ' - `--tags`: run only test with given tags (using the `jasmine-spec-tags` framework)' ,
6471 ' - `--width`(dflt: 1035): set width of the browser window' ,
6572 ' - `--height` (dflt: 617): set height of the browser window' ,
@@ -113,7 +120,6 @@ var pathToUnpolyfill = path.join(__dirname, 'assets', 'unpolyfill.js');
113120var pathToMathJax = path . join ( constants . pathToDist , 'extras' , 'mathjax' ) ;
114121
115122var reporters = ( ( isFullSuite && ! argv . tags ) || argv . showSkipped ) ? [ 'dots' , 'spec' ] : [ 'progress' ] ;
116- if ( argv . failFast ) reporters . push ( 'fail-fast' ) ;
117123if ( argv . verbose ) reporters . push ( 'verbose' ) ;
118124
119125function func ( config ) {
@@ -224,27 +230,33 @@ func.defaultConfig = {
224230 debug : true
225231 } ,
226232
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
245233 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
246252 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+ }
248260 } ,
249261
250262 // use 'karma-spec-reporter' to log info about skipped specs
@@ -253,14 +265,8 @@ func.defaultConfig = {
253265 suppressFailed : true ,
254266 suppressPassed : true ,
255267 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+ }
264270} ;
265271
266272func . defaultConfig . preprocessors [ pathToCustomMatchers ] = [ 'browserify' ] ;
0 commit comments