-
-
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
Tests actual vs expected output is hardly readable #2514
Comments
I think this may be a ckeditor5-dev ticket. Some smarter diff would be indeed welcome. |
cc @pomek |
For that reason I've created simple formatting mechanism in tables (table centric only): I would love to have something smarter (more like diffs on github). 👏 |
@Reinmar I get annoyed by the output of the PFO tests: Go and find what's wrong here (it's a single space). So I've fiddle out with https://www.npmjs.com/package/js-beautify in PFO tests: const b = string => beautify.html_beautify( string, { indent_size: 2, space_in_empty_paren: true } );
expect( b( actualModel.replace( /\u00A0/g, ' ' ) ) ).to.equal( b( expectedModel ) );
if ( actualImages.length > 0 && expectedImages.length > 0 ) {
expect( actualImages.length ).to.equal( expectedImages.length );
expect( actualImages ).to.deep.equal( expectedImages );
} It is the similar approach I've used with tables - format the HTML string. It plays nice with the mocha's differ and we could introduce it as some test util that enhance expects: compareHTML( expected, actual ); ps.: It should play well with model strings (I check it with some table model structure). |
Feature: Introduce `assertEqualMarkup()` test util method. Closes ckeditor/ckeditor5-paste-from-office#14.
At the current state, unit tests (both normalization and integration tests) use the regular expect which compares two strings. While for integration tests it is somehow acceptable (because compared content is rather short), for normalization tests the output is usually unreadable:
It will be good to employ some diffing mechanism which will highlight the parts which are different (or any other reasonable mechanism to make the output readable).
The text was updated successfully, but these errors were encountered: