Skip to content

Commit 7405df3

Browse files
committed
Additional changes to avoid config deprecation warnings (from jasmine-core).
1 parent 86a4a1a commit 7405df3

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

lib/jasmine.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ function Jasmine(options) {
3939
}
4040

4141
Jasmine.prototype.randomizeTests = function(value) {
42-
this.env.randomizeTests(value);
42+
this.env.configure({random: value});
4343
};
4444

4545
Jasmine.prototype.seed = function(value) {
46-
this.env.seed(value);
46+
this.env.configure({seed: value});
4747
};
4848

4949
Jasmine.prototype.showColors = function(value) {
@@ -115,22 +115,22 @@ Jasmine.prototype.loadConfigFile = function(configFilePath) {
115115
Jasmine.prototype.loadConfig = function(config) {
116116
this.specDir = config.spec_dir || this.specDir;
117117

118-
var configOptions = {};
118+
var configuration = {};
119119

120120
if (config.stopSpecOnExpectationFailure !== undefined) {
121-
configOptions.oneFailurePerSpec = config.stopSpecOnExpectationFailure;
121+
configuration.oneFailurePerSpec = config.stopSpecOnExpectationFailure;
122122
}
123123

124124
if (config.stopOnSpecFailure !== undefined) {
125-
configOptions.failFast = config.stopOnSpecFailure;
125+
configuration.failFast = config.stopOnSpecFailure;
126126
}
127127

128128
if (config.random !== undefined) {
129-
configOptions.random = config.random;
129+
configuration.random = config.random;
130130
}
131131

132-
if (Object.keys(configOptions).length > 0) {
133-
this.env.configure(configOptions);
132+
if (Object.keys(configuration).length > 0) {
133+
this.env.configure(configuration);
134134
}
135135

136136
if(config.helpers) {
@@ -195,11 +195,11 @@ Jasmine.prototype.onComplete = function(onCompleteCallback) {
195195
};
196196

197197
Jasmine.prototype.stopSpecOnExpectationFailure = function(value) {
198-
this.env.throwOnExpectationFailure(value);
198+
this.env.configure({oneFailurePerSpec: value});
199199
};
200200

201201
Jasmine.prototype.stopOnSpecFailure = function(value) {
202-
this.env.stopOnSpecFailure(value);
202+
this.env.configure({failFast: value});
203203
};
204204

205205
Jasmine.prototype.exitCodeCompletion = function(passed) {
@@ -243,9 +243,9 @@ Jasmine.prototype.execute = function(files, filterString) {
243243
var specFilter = new ConsoleSpecFilter({
244244
filterString: filterString
245245
});
246-
this.env.specFilter = function(spec) {
246+
this.env.configure({specFilter: function(spec) {
247247
return specFilter.matches(spec.getFullName());
248-
};
248+
}});
249249
}
250250

251251
if (files && files.length > 0) {

spec/jasmine_spec.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ describe('Jasmine', function() {
1111
addMatchers: jasmine.createSpy('addMatchers'),
1212
provideFallbackReporter: jasmine.createSpy('provideFallbackReporter'),
1313
execute: jasmine.createSpy('execute'),
14-
throwOnExpectationFailure: jasmine.createSpy('throwOnExpectationFailure'),
15-
stopOnSpecFailure: jasmine.createSpy('stopOnSpecFailure'),
16-
randomizeTests: jasmine.createSpy('randomizeTests'),
1714
configure: jasmine.createSpy('configure')
1815
}),
1916
Timer: jasmine.createSpy('Timer')
@@ -297,21 +294,21 @@ describe('Jasmine', function() {
297294
describe('#stopSpecOnExpectationFailure', function() {
298295
it('sets the throwOnExpectationFailure value on the jasmine-core env', function() {
299296
this.testJasmine.stopSpecOnExpectationFailure('foobar');
300-
expect(this.testJasmine.env.throwOnExpectationFailure).toHaveBeenCalledWith('foobar');
297+
expect(this.testJasmine.env.configure).toHaveBeenCalledWith({oneFailurePerSpec: 'foobar'});
301298
});
302299
});
303300

304301
describe('#stopOnSpecFailure', function() {
305302
it('sets the stopOnSpecFailure value on the jasmine-core env', function() {
306303
this.testJasmine.stopOnSpecFailure('blah');
307-
expect(this.testJasmine.env.stopOnSpecFailure).toHaveBeenCalledWith('blah');
304+
expect(this.testJasmine.env.configure).toHaveBeenCalledWith({failFast: 'blah'});
308305
});
309306
});
310307

311308
describe('#randomizeTests', function() {
312309
it('sets the randomizeTests value on the jasmine-core env', function() {
313310
this.testJasmine.randomizeTests('foobar');
314-
expect(this.testJasmine.env.randomizeTests).toHaveBeenCalledWith('foobar');
311+
expect(this.testJasmine.env.configure).toHaveBeenCalledWith({random: 'foobar'});
315312
});
316313
});
317314

@@ -402,7 +399,7 @@ describe('Jasmine', function() {
402399
this.testJasmine.loadConfigFile();
403400

404401
this.testJasmine.execute(['spec/fixtures/**/*spec.js'], 'interesting spec');
405-
expect(this.testJasmine.env.specFilter).toEqual(jasmine.any(Function));
402+
expect(this.testJasmine.env.configure).toHaveBeenCalledWith({specFilter: jasmine.any(Function)});
406403
});
407404

408405
it('adds an exit code reporter', function() {

0 commit comments

Comments
 (0)