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/lib
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
..
allow-lister-test.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
bookmark-test.js FIX: flaky javascript tests with fake timers (#13235) 2021-06-11 13:51:27 +04:00
category-badge-test.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
click-track-edit-history-test.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
click-track-profile-page-test.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
click-track-test.js FIX: Clicking on a URL with a different url prefix did not work (#13349) 2021-06-11 11:44:30 +10:00
computed-test.js DEV: prettier 2.2.1 (#11862) 2021-01-27 12:39:20 +01:00
emoji-store-test.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
emoji-test.js DEV: Remove JoyPixels emoji option (#12197) 2021-02-26 07:44:52 -05:00
formatter-test.js DEV: prettier 2.2.1 (#11862) 2021-01-27 12:39:20 +01:00
get-url-test.js FIX: subfolder prefix should work even if url starts with the prefix (#12284) 2021-03-04 16:46:22 -05:00
highlight-search-test.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
i18n-test.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
icon-library-test.js FIX: Escape Font Awesome icons (#12421) 2021-03-17 16:11:40 +03:00
key-value-store-test.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
keyboard-shortcuts-test.js DEV: Add more keyboard shortcut acceptance tests (#13280) 2021-06-04 14:04:20 +10:00
link-lookup-test.js FIX: Normalize links by converting them to lower case 2020-12-11 11:16:51 -05:00
link-mentions-test.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
load-script-test.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
oneboxer-test.js FIX: Tests were broken in Firefox (#12456) 2021-03-22 11:35:51 +11:00
parse-bbcode-tag-test.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
preload-store-test.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
pretty-text-test.js FIX: Split link watched words from replace (#13196) 2021-06-02 15:36:49 +10:00
sanitizer-test.js FEATURE: support mark tag (#12088) 2021-02-15 21:47:30 +05:30
screen-track-test.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
search-test.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
sharing-test.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
text-direction-test.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
time-utils-test.js FIX: flaky javascript tests with fake timers (#13235) 2021-06-11 13:51:27 +04:00
to-markdown-test.js FEATURE: support mark tag (#12088) 2021-02-15 21:47:30 +05:30
upload-short-url-test.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
uploads-test.js DEV: prettier 2.2.1 (#11862) 2021-01-27 12:39:20 +01:00
url-test.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
user-search-test.js DEV: Correct typos and spelling mistakes (#12812) 2021-05-21 11:43:47 +10:00
utilities-test.js DEV: prettier 2.2.1 (#11862) 2021-01-27 12:39:20 +01:00