-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failing MentionUI unit tests on CI #6002
Comments
We had this issues in the past multiple times. We don't do a perfect job when it comes to tearing down some of the tests. This could be improved for sure. Also, we could have some automated check for whether there are some editors left in the DOM. That'd be a first good step. We would still miss virtual editors, but they don't cause such big issues. |
PS. There are actually two scenarios possible:
The former is easier to check. The latter is a bit more tricky, but perhaps some heuristic can be written for it too. |
OMG - I've just got that thought that this might be a reason that our memory leaks were failing... Anyway, some automated test would be cool but the simplest way to check this might be seen after what tests this number grows (must be put in the global context): afterEach( () => {
console.log( 'I have this many editors:', document.querySelectorAll( '.ck-editor' ).length );
} ); After that, I've found that for instance, CKFinder adapter tests leaked 11 editors: ckeditor/ckeditor5-adapter-ckfinder#15. |
I can already tell that we have quite a few tests that do poor job with cleaning up the editor / DOM. As a test I just did
before the Now we can either:
I'm more keen towards the latter as it requires much less work while mitigates the issue. I'm also thinking about adding a check on this. We could even prevent this from happening in the second approach. We could simply add at the end extra test case where it asserts dead editor count against known number of tests. It will catch the case when someone adds new leftover. |
I disagree. We still going to have poor tests and some potential problems. The only problem is time. The job might be big but the ROI is not so easy to calculate IMO since this is a technological dept we have and never have time to properly fix it. It will hount us. Maybe a temporary fix with cleanup + warning ("Yo, I've cleanup XX editors for you") to the trick and we can clean each package in spare time? Also, I see a potential benefit in re-enabling memory leak tests and bring some quality of the project by fixing our tests. |
As shown in #6002 (comment) detecting DOM leaks is pretty easy (though I simplified it do check only I do believe that it will also be possible to add an automated check for editor instances leakage (with no need of modifying current tests), although I'll need to verify this idea later on. This would address another part of #409. |
Also personally I wouldn't mind making handling helpers removal easier. E.g. we could add in our tests code that would allow you to call `disposables.add( domRoot )`, `disposables.add( editor )`, `disposables.add( newEditor )` - a stack that would be automatically cleaned up after each test case. That way instead of doing `afterEach` each time we allocate stuff, we only would have to add our editor/DOM element (potentially anything else) `disposables.add( ... )` and not worry about cleaning this up manually. But that's just a nice to have quality of live improvement imo. |
Tests: Fixed tests leaking editor instances / DOM elements. See ckeditor/ckeditor5#6002.
Tests: Fixed tests leaking editor instances and DOM elements. See ckeditor/ckeditor5#6002.
Tests: Fixed tests leaking editor instances and DOM elements. See ckeditor/ckeditor5#6002.
Tests: Fixed tests leaking editor instances / DOM elements. See ckeditor/ckeditor5#6002.
Tests: Fixed tests leaking editor instances / DOM elements. See ckeditor/ckeditor5#6002.
Tests: Fixed tests leaking editor instances / DOM elements. See ckeditor/ckeditor5#6002.
Tests: Fixed tests leaking editor instances / DOM elements. See ckeditor/ckeditor5#6002.
Tests: Fixed tests leaking editor instances / DOM elements. See ckeditor/ckeditor5#6002.
Tests: Fixed tests leaking editor instances / DOM elements. See ckeditor/ckeditor5#6002.
Tests: Fixed tests leaking editor instances / DOM elements. See ckeditor/ckeditor5#6002.
Tests: Fixed tests leaking editor instances / DOM elements. See ckeditor/ckeditor5#6002.
Tests: Fixed tests leaking editor instances / DOM elements. See ckeditor/ckeditor5#6002.
Tests: Fixed tests leaking editor instances / DOM elements. See ckeditor/ckeditor5#6002.
Tests: Fixed tests leaking editor instances / DOM elements. See ckeditor/ckeditor5#6002.
Tests: Fixed tests leaking editor instances / DOM elements. See ckeditor/ckeditor5#6002.
All required PRs (#6002 (comment)) have been merged. Closing. |
Tests: Fixed tests leaking editor instances / DOM elements. See ckeditor/ckeditor5#6002.
Tests: Fixed tests leaking editor instances / DOM elements. See ckeditor/ckeditor5#6002.
Tests: Fixed tests leaking editor instances / DOM elements. See ckeditor/ckeditor5#6002.
Provide a description of the task
There are two failing tests on CI after merging #4619 PR:
Tests fail only if enough tests are ran, they won't fail if you
yarn run test -f mention
.After investigation it turned out that the reason for it is that there are
scorll
events fired once mocha gets to execute mention plugin tests. That's because there are many, many editor leftovers after prior tests that haven't been cleaned up correctly.This is the source for scroll events.
The text was updated successfully, but these errors were encountered: