Resolve deprecation warnings for Jasmine
Jasmine recommends to use the `configure` method on the environment during boot. This commit makes the code correspond to how it's done in Jasmine's default boot file. The options dropdown in the HTML reporter now works again after these changes, because this broke in the upgrade to Jasmine 3, and the unit tests are executed in a random order by default, which is important to make sure the unit tests are self-contained and don't depend on the result of another unit test.
This commit is contained in:
parent
fd3b780a74
commit
016c2761da
@ -76,34 +76,27 @@ function initializePDFJS(callback) {
|
||||
},
|
||||
});
|
||||
|
||||
var stoppingOnSpecFailure = queryString.getParam('failFast');
|
||||
env.stopOnSpecFailure(typeof stoppingOnSpecFailure === 'undefined' ?
|
||||
false : stoppingOnSpecFailure);
|
||||
|
||||
var throwingExpectationFailures = queryString.getParam('throwFailures');
|
||||
env.throwOnExpectationFailure(throwingExpectationFailures);
|
||||
var config = {
|
||||
failFast: queryString.getParam('failFast'),
|
||||
oneFailurePerSpec: queryString.getParam('oneFailurePerSpec'),
|
||||
hideDisabled: queryString.getParam('hideDisabled'),
|
||||
};
|
||||
|
||||
var random = queryString.getParam('random');
|
||||
env.randomizeTests(random);
|
||||
if (random !== undefined && random !== '') {
|
||||
config.random = random;
|
||||
}
|
||||
|
||||
var seed = queryString.getParam('seed');
|
||||
if (seed) {
|
||||
env.seed(seed);
|
||||
config.seed = seed;
|
||||
}
|
||||
|
||||
// Reporters
|
||||
var htmlReporter = new jasmine.HtmlReporter({
|
||||
env,
|
||||
onStopExecutionClick() {
|
||||
queryString.navigateWithNewParam('failFast',
|
||||
env.stoppingOnSpecFailure());
|
||||
},
|
||||
onThrowExpectationsClick() {
|
||||
queryString.navigateWithNewParam('throwFailures',
|
||||
!env.throwingExpectationFailures());
|
||||
},
|
||||
onRandomClick() {
|
||||
queryString.navigateWithNewParam('random', !env.randomTests());
|
||||
navigateWithNewParam(key, value) {
|
||||
return queryString.navigateWithNewParam(key, value);
|
||||
},
|
||||
addToExistingQueryString(key, value) {
|
||||
return queryString.fullStringWithNewParam(key, value);
|
||||
@ -136,10 +129,12 @@ function initializePDFJS(callback) {
|
||||
},
|
||||
});
|
||||
|
||||
env.specFilter = function(spec) {
|
||||
config.specFilter = function(spec) {
|
||||
return specFilter.matches(spec.getFullName());
|
||||
};
|
||||
|
||||
env.configure(config);
|
||||
|
||||
// Sets longer timeout.
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000;
|
||||
|
||||
|
@ -125,34 +125,27 @@ function initializePDFJS(callback) {
|
||||
},
|
||||
});
|
||||
|
||||
var stoppingOnSpecFailure = queryString.getParam('failFast');
|
||||
env.stopOnSpecFailure(typeof stoppingOnSpecFailure === 'undefined' ?
|
||||
false : stoppingOnSpecFailure);
|
||||
|
||||
var throwingExpectationFailures = queryString.getParam('throwFailures');
|
||||
env.throwOnExpectationFailure(throwingExpectationFailures);
|
||||
var config = {
|
||||
failFast: queryString.getParam('failFast'),
|
||||
oneFailurePerSpec: queryString.getParam('oneFailurePerSpec'),
|
||||
hideDisabled: queryString.getParam('hideDisabled'),
|
||||
};
|
||||
|
||||
var random = queryString.getParam('random');
|
||||
env.randomizeTests(random);
|
||||
if (random !== undefined && random !== '') {
|
||||
config.random = random;
|
||||
}
|
||||
|
||||
var seed = queryString.getParam('seed');
|
||||
if (seed) {
|
||||
env.seed(seed);
|
||||
config.seed = seed;
|
||||
}
|
||||
|
||||
// Reporters
|
||||
var htmlReporter = new jasmine.HtmlReporter({
|
||||
env,
|
||||
onStopExecutionClick() {
|
||||
queryString.navigateWithNewParam('failFast',
|
||||
env.stoppingOnSpecFailure());
|
||||
},
|
||||
onThrowExpectationsClick() {
|
||||
queryString.navigateWithNewParam('throwFailures',
|
||||
!env.throwingExpectationFailures());
|
||||
},
|
||||
onRandomClick() {
|
||||
queryString.navigateWithNewParam('random', !env.randomTests());
|
||||
navigateWithNewParam(key, value) {
|
||||
return queryString.navigateWithNewParam(key, value);
|
||||
},
|
||||
addToExistingQueryString(key, value) {
|
||||
return queryString.fullStringWithNewParam(key, value);
|
||||
@ -185,10 +178,12 @@ function initializePDFJS(callback) {
|
||||
},
|
||||
});
|
||||
|
||||
env.specFilter = function(spec) {
|
||||
config.specFilter = function(spec) {
|
||||
return specFilter.matches(spec.getFullName());
|
||||
};
|
||||
|
||||
env.configure(config);
|
||||
|
||||
// Sets longer timeout.
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user