Skip to content

Commit be3da83

Browse files
committed
add --random CLI opts (new for jasmine v3 !!)
... with a default false, overriding the jasmine v3 default which makes a lot of test fail!
1 parent b477955 commit be3da83

File tree

1 file changed

+34
-21
lines changed

1 file changed

+34
-21
lines changed

test/jasmine/karma.conf.js

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ var path = require('path');
44
var minimist = require('minimist');
55
var constants = require('../../tasks/util/constants');
66

7-
var isCI = !!process.env.CI;
7+
var isCI = Boolean(process.env.CI);
8+
89
var 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',
@@ -224,27 +231,32 @@ func.defaultConfig = {
224231
debug: true
225232
},
226233

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
245234
client: {
235+
// Options for `karma-jasmine-spec-tags`
236+
// see https://www.npmjs.com/package/karma-jasmine-spec-tags
237+
//
238+
// A few tests don't behave well on CI
239+
// add @noCI to the spec description to skip a spec on CI
240+
//
241+
// Although not recommended, some tests "depend" on other
242+
// tests to pass (e.g. the Plotly.react tests check that
243+
// all available traces and transforms are tested). Tag these
244+
// with @noCIdep, so that
245+
// - $ npm run test-jasmine -- tags=noCI,noCIdep
246+
// can pass.
247+
//
248+
// Label tests that require a WebGL-context by @gl so that
249+
// they can be skipped using:
250+
// - $ npm run test-jasmine -- --skip-tags=gl
251+
// or run is isolation easily using:
252+
// - $ npm run test-jasmine -- --tags=gl
246253
tagPrefix: '@',
247-
skipTags: isCI ? 'noCI' : null
254+
skipTags: isCI ? 'noCI' : null,
255+
256+
// See https://jasmine.github.io/api/3.4/Configuration.html
257+
jasmine: {
258+
random: argv.randomize
259+
}
248260
},
249261

250262
// use 'karma-spec-reporter' to log info about skipped specs
@@ -259,6 +271,7 @@ func.defaultConfig = {
259271
failFast: false
260272
},
261273

274+
// TODO !!!
262275
// e.g. when a test file does not container a given spec tags
263276
failOnEmptyTestSuite: false
264277
};

0 commit comments

Comments
 (0)