Page MenuHomePhabricator

Run WikibaseLexeme tests without browser and mediawiki dependencies
Closed, ResolvedPublic

Description

The current unit testing setup has some issues:

  • depends for setting up and running a mediawiki server just to execute JS unit tests. this can prevent JS devs from contributing and hinders onboarding because it requires knowledge about multiple ecosystems and mediawiki-specific skills
  • depends on a browser as execution environment. test execution requires switching to browser, manual reloading. also slow test execution. this is an impediment for TDD.
  • test dependencies are hidden outside the test via resource loader, making them hard to understand and - again - couples js tests to mediawiki and reduces cohesion of the system. Doing it this we reduces decouling, but also decreases cohesion of the system
  • lack of IDE integration making executing, debugging, interpreting results, etc. unneccessary hard

Implementation: There are options to execute qunit tests from CLI and tools, but
enabling this requires setting up a browser environemnt using e.g. jsdom. See if this is feasible, otherwise port Lexeme tests to jasmine or others.

Scope: As a proof of concept, integrate it and port one tests. Finish porting
the others with regular work (whenever we need to touch the test anyway), or
find/create a codemod script to automate.

Event Timeline

What left is removing dependency on globals in the GlossWidget.

Also, migration of other VueJs widgets' tests

Change 369674 had a related patch set uploaded (by Aleksey Bekh-Ivanov (WMDE); owner: Aleksey Bekh-Ivanov (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] Decouple GlossWidget from mediaWiki global variable

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

Change 369411 had a related patch set uploaded (by Aleksey Bekh-Ivanov (WMDE); owner: Aleksey Bekh-Ivanov (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] Decouple GlossWidget from mediaWiki global variable

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

Change 369674 abandoned by Aleksey Bekh-Ivanov (WMDE):
Decouple GlossWidget from mediaWiki global variable

Reason:
Forgot to amend previous patch

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

Change 369411 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Decouple GlossWidget from mediaWiki global variable

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