Page MenuHomePhabricator

Write unit tests for JavaScriptMinifier, CSSMin and CSSJanus
Closed, ResolvedPublic

Description

Write unit tests for JS/CSS minifier. As we find the odd boundary/wrong minification, they should be logged to prevent regressions


Version: unspecified
Severity: enhancement

Details

Reference
bz27395

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:16 PM
bzimport set Reference to bz27395.

bug 26931
bug 27046
bug 27054
bug 27052

etc should be test cases

I added a basic testing framework for JS minifier in r82648, but can't really cover all cases because those regexes are write-only.

(In reply to comment #2)

I added a basic testing framework for JS minifier in r82648, but can't really
cover all cases because those regexes are write-only.

Can you elaborate what you mean? Also, why are the js snippets in separate files?

(In reply to comment #4)

(In reply to comment #2)

I added a basic testing framework for JS minifier in r82648, but can't really
cover all cases because those regexes are write-only.

Can you elaborate what you mean? Also, why are the js snippets in separate
files?

Ah, looks like it has changed in the mean time. We've got a pretty good coverage of CSS minification tests now:
https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=tree;f=tests/phpunit/includes/libs;h=779b41ecc126eb57dd88cbf523d15b8b9a549ac0;hb=HEAD

Just need some for CSS.

(In reply to comment #1)

bug 26931
bug 27046
bug 27054
bug 27052

Added test cases for bug 26931 and bug 27046 in I7a4df097108ec05bc58d5a110329e13ff9587c8a.

bug 27054 wasn't a bug in the minifier and has been solved in ResourceLoader).

Working on CSSMin and CSSJanus now.

CSSMin: 41759f322ce9e7471f6f8ade6175354f6d5df942

CSSJanus: If40c5de54bffae6e5ac8fac81754a53a40c652b1