Jest: Error using jasmine clock after upgrade to jest-cli 20.0.4

Created on 20 Jun 2017  路  3Comments  路  Source: facebook/jest

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

I have a unit test that use jasmin.clock.install

I have the following error using jest-cli 20.0.4

TypeError: jasmine.clock is not a function

What package should I have in order to have this line work in my unit test :

jasmine.clock().install();

I managed to make it work by downgrading to jest-cli 19.0.1. it would be nice to know the upgrade procedure.

Most helpful comment

This must have been removed while rewriting Jasmine. Use fake timers instead: http://facebook.github.io/jest/docs/jest-object.html#jestusefaketimers

All 3 comments

This must have been removed while rewriting Jasmine. Use fake timers instead: http://facebook.github.io/jest/docs/jest-object.html#jestusefaketimers

@thymikee but looks like jest has nothing to offer instead of this handy date mocks from jasmine

Not for now, but we'll be bundling Lolex soon (#7776) which will handle it. In the meantime, you can install lolex yourself

Was this page helpful?
0 / 5 - 0 ratings