Page MenuHomePhabricator

SpecialJavaScriptTest should not export page-specific mw.config
Closed, ResolvedPublic

Description

Right now Special:JavaScriptTest/qunit/plain exports page-specific mw.config values provided by OutputPage (in addition to the site-wide values from the startup module).

There's only a few random tests here and there that accidentally depend on mw.config values (usually whatever the default is). This should be resolved by setting the relevant values in the test suite from a setup handler.

There are also some cases where a module both exports an interface (which is tested) and self-initialising code for a wiki page. In such case, the initialising code usually runs immediately and thus before the test start. While having that run as a no-op is fine. Issues arise from values missing in mw.config as init code rightfully requires those values to be present in mw.config.

In those cases, the initialisation code should be run from a hook like wikipage.content (which doesn't run in the test suite). Or moved to a separate module not loaded by the test. Or, if the init code is testable, it should additionally be exposed so that its execution can be controlled by the test instead of at runtime.

Event Timeline

Krinkle raised the priority of this task from to Medium.
Krinkle updated the task description. (Show Details)
Krinkle added subscribers: Aklapper, Krinkle.
gerritbot subscribed.

Change 190421 had a related patch set uploaded (by Krinkle):
Move svgMaxSize and namespacesWithSubpages to site config

https://gerrit.wikimedia.org/r/190421

Patch-For-Review

Change 190421 merged by jenkins-bot:
Move svgMaxSize and namespacesWithSubpages to site config

https://gerrit.wikimedia.org/r/190421

Change 500819 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] qunit: Start whitelisting OutputPage/mw.config on SpecialJavaScriptTest

https://gerrit.wikimedia.org/r/500819

Change 500819 abandoned by Krinkle:
qunit: Whitelist OutputPage js vars on SpecialJavaScriptTest

https://gerrit.wikimedia.org/r/500819

Change 500819 restored by Krinkle:

[mediawiki/core@master] qunit: Whitelist OutputPage js vars on SpecialJavaScriptTest

https://gerrit.wikimedia.org/r/500819

Change 762946 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/extensions/GrowthExperiments@master] tests: Mock wgArticleId instead of relying on SpecialPage value

https://gerrit.wikimedia.org/r/762946

Change 762947 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/extensions/VisualEditor@master] tests: Mock wgVisualEditor instead of relying on SpecialPage value

https://gerrit.wikimedia.org/r/762947

Change 762947 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] tests: Mock wgVisualEditor instead of relying on SpecialPage value

https://gerrit.wikimedia.org/r/762947

Change 766115 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/extensions/VisualEditor@master] tests: Mock more of wgVisualEditor for ve.init.mw.DesktopArticleTarget

https://gerrit.wikimedia.org/r/766115

Change 762946 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] tests: Mock wgArticleId instead of relying on SpecialPage value

https://gerrit.wikimedia.org/r/762946

Change 500819 merged by jenkins-bot:

[mediawiki/core@master] qunit: Remove most mw.config OutputPage vars from SpecialJavaScriptTest

https://gerrit.wikimedia.org/r/500819

Change 772502 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/core@master] qunit: Remove OutputPage::getJSVars() call from test runner

https://gerrit.wikimedia.org/r/772502

Change 772502 merged by jenkins-bot:

[mediawiki/core@master] qunit: Remove OutputPage::getJSVars() call from test runner

https://gerrit.wikimedia.org/r/772502