moment / moment-timezone

Timezone support for moment.js
momentjs.com/timezone
MIT License
3.83k stars 838 forks source link

Unable to run Karma Jasmine specs using moment-timezone #570

Open satyaki1 opened 6 years ago

satyaki1 commented 6 years ago

I am using AngularJS 1.5.5 application with following moment libs added - moment - v2.13.0 moment-timezone - v0.5.13

I don't face any issue while running the application with the following code in app.js in browser moment.tz.setDefault("Asia/Singapore");

But the same line throws error while I'm running my specs written in Jasmine v2.5.2 using karma v.^1.4.0. The error is :

TypeError: Cannot read property 'setDefault' of undefined

This is how my karma.conf.js - files attribute looks like -

'vendor/assets/bower_components/moment/moment.js', 'vendor/assets/bower_components/moment-timezone/moment-timezone.js', 'vendor/assets/bower_components/moment-timezone/builds/moment-timezone-with-data.js', 'vendor/assets/bower_components/moment-timezone/builds/moment-timezone-with-data-2012-2022.js', 'vendor/assets/bower_components/angular-mocks/angular-mocks.js',

victormiguez commented 6 years ago

Same problem here, but I'm running the tests with Jest. Version 0.5.13 works fine.

vpratti commented 6 years ago

@satyaki1 Do you have any resolution for it. I am in the same boat.

satyaki1 commented 6 years ago

@vpratti No luck. @ellenaua @mj1856 Any clue on this?