Page MenuHomePhabricator

Support image references in LESS code from imported subdirectories (ResourcesTest::testResourceFiles fails)
Open, MediumPublic

Description

Seen on https://gerrit.wikimedia.org/r/#/c/mediawiki/skins/WikimediaApiPortal/+/589022/

18:26:09 1) ResourcesTest::testResourceFiles
18:26:09 File '/workspace/src/skins/WikimediaApiPortal/resources/stylesheets/../../../images/icon/search_grey.svg' referenced by 'skin.wikimediaapiportal.styles' must exist.
18:26:09 Failed asserting that file "/workspace/src/skins/WikimediaApiPortal/resources/stylesheets/../../../images/icon/search_grey.svg" exists.
18:26:09 
18:26:09 /workspace/src/tests/phpunit/structure/ResourcesTest.php:291
18:26:09 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:437
18:26:09 /workspace/src/maintenance/doMaintenance.php:105

The dependancy resolution of the images, from this code:

.wm-search-button-submit:after {
	/* @embed */
	background-image: url( '../../../images/icon/search_grey.svg' );
}

in file resources/stylesheets/common/header/search.less seems to resolved relative to the location of the file it is included into, not the file it's included from

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Krinkle renamed this task from ResourceTest::testResourceFiles() resolution in LESS files to Support image references in LESS code from imported subdirectories (ResourceTest::testResourceFiles fails).Jun 15 2020, 8:00 PM
Krinkle triaged this task as Medium priority.
Krinkle moved this task from Inbox to Confirmed Problem on the MediaWiki-ResourceLoader board.
Krinkle moved this task from Inbox to PHPUnit on the MediaWiki-Core-Tests board.

A few possibilities:

  • The LESS parser is bugged/confused and not remapping them correctly for some reason. This would mean it is not just affecting the test but also the output (which is likely not an issue today given the test prevents such code from being merged/deployed).
  • Or maybe a later phase in RL (missingLocalFileRefs) is not interpreting the paths correctly after the fact.
  • Or maybe the test suite itself is caling the RL code incorrectly, losing the path somehow.
Krinkle renamed this task from Support image references in LESS code from imported subdirectories (ResourceTest::testResourceFiles fails) to Support image references in LESS code from imported subdirectories (ResourcesTest::testResourceFiles fails).May 9 2023, 3:31 PM