diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 401d5df6..ee776eab 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -7054,10 +7054,9 @@ getJasmineRequireObj().MockDate = function(j$) { currentTime = mockDate.getTime(); } else { if (!j$.util.isUndefined(mockDate)) { - j$.getEnv().deprecated( + throw new Error( 'The argument to jasmine.clock().mockDate(), if specified, ' + - 'should be a Date instance. Passing anything other than a Date ' + - 'will be treated as an error in a future release.' + 'should be a Date instance.' ); } diff --git a/spec/core/ClockSpec.js b/spec/core/ClockSpec.js index 126fe8ca..69c05fc4 100644 --- a/spec/core/ClockSpec.js +++ b/spec/core/ClockSpec.js @@ -950,7 +950,7 @@ describe('Clock (acceptance)', function() { expect(timeoutDate).toEqual(baseTime.getTime() + 150); }); - it('logs a deprecation when mockDate is called with a non-Date', function() { + it('throws mockDate is called with a non-Date', function() { var delayedFunctionScheduler = new jasmineUnderTest.DelayedFunctionScheduler(), global = { Date: Date }, mockDate = new jasmineUnderTest.MockDate(global), @@ -963,12 +963,9 @@ describe('Clock (acceptance)', function() { ), env = jasmineUnderTest.getEnv(); - spyOn(env, 'deprecated'); - clock.mockDate(12345); - expect(env.deprecated).toHaveBeenCalledWith( + expect(() => clock.mockDate(12345)).toThrowError( 'The argument to jasmine.clock().mockDate(), if specified, should be ' + - 'a Date instance. Passing anything other than a Date will be ' + - 'treated as an error in a future release.' + 'a Date instance.' ); }); diff --git a/src/core/MockDate.js b/src/core/MockDate.js index e8738a44..feefe458 100644 --- a/src/core/MockDate.js +++ b/src/core/MockDate.js @@ -17,10 +17,9 @@ getJasmineRequireObj().MockDate = function(j$) { currentTime = mockDate.getTime(); } else { if (!j$.util.isUndefined(mockDate)) { - j$.getEnv().deprecated( + throw new Error( 'The argument to jasmine.clock().mockDate(), if specified, ' + - 'should be a Date instance. Passing anything other than a Date ' + - 'will be treated as an error in a future release.' + 'should be a Date instance.' ); }