This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/tests/unit
Andrei Prigorshnev 178b294a62
FIX: flaky javascript tests with fake timers (#13235)
The problem was happening in component integration tests on the rendering stage, sometimes the rendering would never finish.

Using time moments in the future when faking time solves the problem. Unfortunately, I don't know why exactly it helps. It was just a lucky guess after some hours I spent trying to figure out what's going on. But I've done a lot of testings, so looks like it really works. I'll be monitoring builds for some time after merging this anyway.

Unit tests seem to work alright with moments in the past. And we don't fake time in acceptance tests at the moment but I guess they would very likely be flaky with time moments from the past since they also do rendering.

I'm actually thinking of moving all fake time moments to the future (including moments in unit tests) to decrease the chances of flakiness. But I don't want to do everything in one PR, because I can accidentally introduce new flakiness.

A pretty easy way of picking time moments in the future for tests is to use the 2100 year. It has the same calendar as 2021. If a day is Monday in 2021 it's Monday in 2100 too.
2021-06-11 13:51:27 +04:00
..
controllers UX: Improvements for reordering categories (#13013) 2021-06-09 13:01:06 +03:00
ember DEV: prettier 2.2.1 (#11862) 2021-01-27 12:39:20 +01:00
lib FIX: flaky javascript tests with fake timers (#13235) 2021-06-11 13:51:27 +04:00
mixins DEV: prettier 2.2.1 (#11862) 2021-01-27 12:39:20 +01:00
models DEV: Topic tracking state improvements (#13218) 2021-06-02 09:06:29 +10:00
services DEV: Migrate to Ember CLI (#11932) 2021-02-03 14:22:20 -05:00
utils DEV: Migrate to Ember CLI (#11932) 2021-02-03 14:22:20 -05:00
localization-test.js DEV: Sync up more Ember CLI features (#11790) 2021-01-21 15:55:39 -05:00