-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Unit tests fail when run in Australia #5017
Comments
Perhaps we should add geolocation information to pull requests? |
I get a similar stacktrace when I run the tests in Australia: (92:86:sɾ˙ɔǝdssʞɔoɯ-ɹɐlnƃuɐ/ʞɔoɯƃu/ʇsǝʇ/sɾ˙ɹɐlnƃuɐ/qnɥʇıƃ/ɯɔs/ʇʇǝɹq/sɹǝsn/) <snoɯʎuouɐ>˙llnu ʇɐ
˙12 ɥɔʇɐɯ oʇ 22 pǝʇɔǝdxǝ :ɹoɹɹǝ
˙12 ɥɔʇɐɯ oʇ 22 pǝʇɔǝdxǝ
(92:46:sɾ˙ɔǝdssʞɔoɯ-ɹɐlnƃuɐ/ʞɔoɯƃu/ʇsǝʇ/sɾ˙ɹɐlnƃuɐ/qnɥʇıƃ/ɯɔs/ʇʇǝɹq/sɹǝsn/) <snoɯʎuouɐ>˙llnu ʇɐ
˙0 ǝq oʇ 1 pǝʇɔǝdxǝ :ɹoɹɹǝ
˙0 ǝq oʇ 1 pǝʇɔǝdxǝ
(92:06:sɾ˙ɔǝdssʞɔoɯ-ɹɐlnƃuɐ/ʞɔoɯƃu/ʇsǝʇ/sɾ˙ɹɐlnƃuɐ/qnɥʇıƃ/ɯɔs/ʇʇǝɹq/sɹǝsn/) <snoɯʎuouɐ>˙llnu ʇɐ
˙3 ǝq oʇ 4 pǝʇɔǝdxǝ :ɹoɹɹǝ
˙3 ǝq oʇ 4 pǝʇɔǝdxǝ
pǝlıɐɟ poɥʇǝɯ sɹnoɥʇǝƃ ǝʞɐɟ plnoɥs ǝʇɐpzʇ ʞɔoɯƃu (0˙9˙01 x so ɔɐɯ) 0561˙0˙13 ǝɯoɹɥɔ (in all seriousness, i assigned the issue to myself and will take a look at it) |
I'm willing to handle this in person if a trip to Australia can be expensed for me :) |
Same issue in NZ. |
I don't quite understand why is this the case. The TzDate mock is specifically built to be time-zone agnostic. We compute the offset based on your local settings and then adjust the date to be the same in all timezones. See: angular.js/src/ngMock/angular-mocks.js Lines 647 to 649 in 547871e
I don't understand why this works fine in all timezones except for Australia and New Zealand. Any ideas? |
@IgorMinar hello from the future! Given the off by one, this just appears to be a DST issue (the tests pass if I were to move to Brisbane where they don't practice DST). Thanks for the pointer, that was a helpful clue. I'll put together a pull request. |
Actually, on further investigation, this doesn't look like a bug in the angular tests - perhaps a native problem. DST started in Australia in 1971, so the UNIX epoch was at 10:00 UTC+10, 1/1/70. However, in the tests using a negative offset as these ones do gives a timezone as +11 instead of +10. This can be seen in node as well:
The results seem to vary wildly under conditions I can't control - Safari gets it wrong for even new Date(0), and some conditions I can't reproduce have some Chrome tabs (but not new ones as in karma) doing it right. There's a workaround: to change the tests to convert dates that won't become negative. It's a bit of a kludge, but doesn't seem to invalidate the tests - hopefully that's acceptable? |
In some specific timezones and operating systems, it seems that getTimezoneOffset() can return an incorrect value for negative timestamps, as described in angular#5017. While this isn't something easily fixed in the mock code, the tests can avoid that particular timeframe by using a positive timestamp. Closes angular#5017
In some specific timezones and operating systems, it seems that getTimezoneOffset() can return an incorrect value for negative timestamps, as described in angular#5017. While this isn't something easily fixed in the mock code, the tests can avoid that particular timeframe by using a positive timestamp. Closes angular#5017
In some specific timezones and operating systems, it seems that getTimezoneOffset() can return an incorrect value for negative timestamps, as described in #5017. While this isn't something easily fixed in the mock code, the tests can avoid that particular timeframe by using a positive timestamp. Closes #5017 Closes #6730
I believe this is due to ES5 15.9.1.8 (https://es5.github.io/#x15.9.1.8).
Different JS engines handle dates < 1970 differently when it comes to local timezone adjustment. Some engines map < 1970 to more modern years, which would explain why you are seeing the date have DST applied even though Australia didn't observe DST then. See: https://bugzilla.mozilla.org/show_bug.cgi?id=351066#c20 and https://bugzilla.mozilla.org/show_bug.cgi?id=1029923 |
+1 |
Lol (sorry) |
Came here from HN.YC. This is funny! :D lol |
+1 - Best bug report ever! |
+1 Australia got digest looped. |
It seems to be an issue with the specification, obviously, the question is, how it should be fixed – as the ECMAscript specification states todays DST should be applied to past years, while other programming languages, and especially users, expect a different behaviour. Either someone would have to write a wrapper around Date that correctly implements previous DST data and fixes therefore the issue, or a different solution needs to be found. I don’t know which would be preferable, but to a user, the current solution is definitely confusing. |
Probably due to implementation differences in browsers for pre-DST period (see angular#5017 and especially angular#5017 (comment) for context), some `TzDate` tests had different behavior on different Timezones/Regions (e.g. failed in Australia, which started to observe DST in 1971). Since the used year (`1970`) didn't have any particular significance, this commit fixes the issue by using a year that is more consistently handled by browsers (`2000`). Fixes angular#14272
Probably due to implementation differences in browsers for pre-DST period (see #5017 and especially #5017 (comment) for context), some `TzDate` tests had different behavior on different Timezones/Regions (e.g. failed in Australia, which started to observe DST in 1971). Since the used year (`1970`) didn't have any particular significance, this commit fixes the issue by using a year that is more consistently handled by browsers (`2000`). Fixes #14272 Closes #14285
Probably due to implementation differences in browsers for pre-DST period (see #5017 and especially #5017 (comment) for context), some `TzDate` tests had different behavior on different Timezones/Regions (e.g. failed in Australia, which started to observe DST in 1971). Since the used year (`1970`) didn't have any particular significance, this commit fixes the issue by using a year that is more consistently handled by browsers (`2000`). Fixes #14272 Closes #14285
I'm receiving the same error reported in this comment: #3474 (comment)
I'm also in Australia/Sydney.
I was able to skip with
--force
, but it'd be good to get a clean bill of health for contributing!The text was updated successfully, but these errors were encountered: