From: Timo Tijhof Date: Fri, 11 Apr 2014 18:40:52 +0000 (-0700) Subject: qunit: Remove race condition in 'test.mediawiki.qunit.testrunner' X-Git-Tag: 1.31.0-rc.0~16252^2 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=bb71fd2ada8f204deae70db9c0c6e7a0a434c6b7;p=lhc%2Fweb%2Fwiklou.git qunit: Remove race condition in 'test.mediawiki.qunit.testrunner' Tests should be atomic because when re-running failed tests, they run out of order (by design). The thing being asserted here wasn't all that useful as that is upstream behaviour we ought to be able to rely on. Change-Id: I2f006e1cf05f5535e8220ca8ffc2da603745d184 --- diff --git a/tests/qunit/data/testrunner.js b/tests/qunit/data/testrunner.js index 7dff354837..ab9aab19d3 100644 --- a/tests/qunit/data/testrunner.js +++ b/tests/qunit/data/testrunner.js @@ -5,7 +5,6 @@ var mwTestIgnore, mwTester, addons, - envExecCount, ELEMENT_NODE = 1, TEXT_NODE = 3; @@ -387,14 +386,12 @@ * Small test suite to confirm proper functionality of the utilities and * initializations defined above in this file. */ - envExecCount = 0; QUnit.module( 'test.mediawiki.qunit.testrunner', QUnit.newMwEnvironment( { setup: function () { - envExecCount += 1; this.mwHtmlLive = mw.html; mw.html = { escape: function () { - return 'mocked-' + envExecCount; + return 'mocked'; } }; }, @@ -410,7 +407,7 @@ } ) ); QUnit.test( 'Setup', 3, function ( assert ) { - assert.equal( mw.html.escape( 'foo' ), 'mocked-1', 'extra setup() callback was ran.' ); + assert.equal( mw.html.escape( 'foo' ), 'mocked', 'setup() callback was ran.' ); assert.equal( mw.config.get( 'testVar' ), 'foo', 'config object applied' ); assert.equal( mw.messages.get( 'testMsg' ), 'Foo.', 'messages object applied' ); @@ -418,8 +415,7 @@ mw.messages.set( 'testMsg', 'Bar.' ); } ); - QUnit.test( 'Teardown', 3, function ( assert ) { - assert.equal( mw.html.escape( 'foo' ), 'mocked-2', 'extra setup() callback was re-ran.' ); + QUnit.test( 'Teardown', 2, function ( assert ) { assert.equal( mw.config.get( 'testVar' ), 'foo', 'config object restored and re-applied after test()' ); assert.equal( mw.messages.get( 'testMsg' ), 'Foo.', 'messages object restored and re-applied after test()' ); } ); @@ -496,7 +492,7 @@ QUnit.module( 'test.mediawiki.qunit.testrunner-after', QUnit.newMwEnvironment() ); QUnit.test( 'Teardown', 3, function ( assert ) { - assert.equal( mw.html.escape( '<' ), '<', 'extra teardown() callback was ran.' ); + assert.equal( mw.html.escape( '<' ), '<', 'teardown() callback was ran.' ); assert.equal( mw.config.get( 'testVar' ), null, 'config object restored to live in next module()' ); assert.equal( mw.messages.get( 'testMsg' ), null, 'messages object restored to live in next module()' ); } );