HomePhabricator

qunit: Update testrunner against changes in MediaWiki core

Authored by Krinkle on Jul 17 2017, 9:28 PM.

Description

qunit: Update testrunner against changes in MediaWiki core

The result of 'QUnit.newMwEnvironment' is only for passing to QUnit.module(),
not to call methods on directly.

Instead of wrapping 'QUnit.newMwEnvironment()' and returning a plain object
with only setup/teardown, use 'QUnit.newMwEnvironment' directly and pass
setup/teardown to it.

That way:

  • Other properties are preserved instead of silently dropped.
  • Core changes from setup/teardown to beforeEach/afterEach will continue to work because Wikibase won't rely on what is returned from it.

Also:

  • Don't use the 'new' operator, since this isn't an instantiable class, it's a static method that returns a plain object.
  • Don't overwrite mw.config.values, instead call mw.config.set().

Bug: T170515
Change-Id: I3cd1b2f6c9edb74fb9369398da2b9d4097784ebd