jenkins-bot has submitted this change and it was merged.
Change subject: tests: Expect the unexpected
......................................................................
tests: Expect the unexpected
This feature is no longer useful since QUnit and our tests are
much more resilient. Mostly due to contextual 'assert' and async,
so tests can no longer fail asynchronously without an error being
caught – which was the main reason this existed.
Change-Id: Ia96249f3dcad10061702a2f3e1bf4d7fd6cc41ef
---
M tests/index.html
M tests/testrunner.js
M tests/unit/EventEmitter.test.js
M tests/unit/Factory.test.js
M tests/unit/Registry.test.js
M tests/unit/core.test.js
M tests/unit/util.test.js
7 files changed, 36 insertions(+), 42 deletions(-)
Approvals:
Mooeypoo: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/index.html b/tests/index.html
index 20d81c4..665d96e 100644
--- a/tests/index.html
+++ b/tests/index.html
@@ -5,9 +5,6 @@
<link rel="stylesheet"
href="../node_modules/qunitjs/qunit/qunit.css">
<title>OOjs Test Suite</title>
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
- <script>
- QUnit.config.requireExpects = true;
- </script>
<!-- Source code -->
<script src="../dist/oojs.js"></script>
<!-- Test suites -->
diff --git a/tests/testrunner.js b/tests/testrunner.js
index 5e4ac4e..81b85d3 100644
--- a/tests/testrunner.js
+++ b/tests/testrunner.js
@@ -1,9 +1,6 @@
( function () {
/*jshint browser:true */
- // Configure QUnit
- QUnit.config.requireExpects = true;
-
// Extend QUnit.module to provide a fixture element. This used to be in
tests/index.html, but
// dynamic test runners like Karma build their own web page.
( function () {
diff --git a/tests/unit/EventEmitter.test.js b/tests/unit/EventEmitter.test.js
index c3070de..dd28125 100644
--- a/tests/unit/EventEmitter.test.js
+++ b/tests/unit/EventEmitter.test.js
@@ -8,7 +8,7 @@
QUnit.module( 'EventEmitter' );
- QUnit.test( 'on', 9, function ( assert ) {
+ QUnit.test( 'on', function ( assert ) {
var callback, x, seq,
ee = new oo.EventEmitter();
@@ -67,7 +67,7 @@
ee.emit( 'post' );
} );
- QUnit.test( 'once', 1, function ( assert ) {
+ QUnit.test( 'once', function ( assert ) {
var seq,
ee = new oo.EventEmitter();
@@ -83,7 +83,7 @@
assert.deepEqual( seq, [ 'call' ], 'Callback ran only once' );
} );
- QUnit.test( 'emit', 7, function ( assert ) {
+ QUnit.test( 'emit', function ( assert ) {
var data1, data2A, data2B, data2C,
ee = new oo.EventEmitter();
@@ -113,7 +113,7 @@
ee.emit( 'dataParams', data2A, data2B, data2C );
} );
- QUnit.test( 'off', 5, function ( assert ) {
+ QUnit.test( 'off', function ( assert ) {
var hits, callback,
ee = new oo.EventEmitter();
@@ -154,7 +154,7 @@
assert.ok( true, 'Unbinding an unknown callback for event named
"hasOwnProperty"' );
} );
- QUnit.test( 'connect', 5, function ( assert ) {
+ QUnit.test( 'connect', function ( assert ) {
var data1, host,
ee = new oo.EventEmitter();
@@ -195,7 +195,7 @@
}, 'Connecting to invalid method' );
} );
- QUnit.test( 'disconnect( host )', 1, function ( assert ) {
+ QUnit.test( 'disconnect( host )', function ( assert ) {
var host,
hits = { foo: 0, bar: 0 },
ee = new oo.EventEmitter();
@@ -223,7 +223,7 @@
assert.deepEqual( hits, { foo: 1, bar: 1 } );
} );
- QUnit.test( 'disconnect( host, methods )', 1, function ( assert ) {
+ QUnit.test( 'disconnect( host, methods )', function ( assert ) {
var host,
hits = { foo: 0, bar: 0 },
ee = new oo.EventEmitter();
@@ -251,7 +251,7 @@
assert.deepEqual( hits, { foo: 1, bar: 2 } );
} );
- QUnit.test( 'disconnect( host, array methods )', 1, function ( assert )
{
+ QUnit.test( 'disconnect( host, array methods )', function ( assert ) {
var host,
hits = { foo: 0, barbara: 0 },
ee = new oo.EventEmitter();
@@ -279,7 +279,7 @@
assert.deepEqual( hits, { foo: 2, barbara: 1 } );
} );
- QUnit.test( 'disconnect( host, unbound methods )', 1, function ( assert
) {
+ QUnit.test( 'disconnect( host, unbound methods )', function ( assert ) {
var host,
ee = new oo.EventEmitter();
@@ -301,7 +301,7 @@
}, 'method must exist on host object even if event has no
listeners' );
} );
- QUnit.test( 'chainable', 5, function ( assert ) {
+ QUnit.test( 'chainable', function ( assert ) {
var fn = function () {},
ee = new oo.EventEmitter();
diff --git a/tests/unit/Factory.test.js b/tests/unit/Factory.test.js
index fc33eb0..210f987 100644
--- a/tests/unit/Factory.test.js
+++ b/tests/unit/Factory.test.js
@@ -17,7 +17,7 @@
/* Tests */
- QUnit.test( 'register/unregister', 4, function ( assert ) {
+ QUnit.test( 'register/unregister', function ( assert ) {
var factory = new oo.Factory();
assert.throws(
function () {
@@ -42,7 +42,7 @@
assert.strictEqual( factory.lookup( 'factory-object-stub' ),
undefined );
} );
- QUnit.test( 'create', 3, function ( assert ) {
+ QUnit.test( 'create', function ( assert ) {
var obj,
factory = new oo.Factory();
@@ -71,7 +71,7 @@
);
} );
- QUnit.test( 'lookup', 1, function ( assert ) {
+ QUnit.test( 'lookup', function ( assert ) {
var factory = new oo.Factory();
factory.register( oo.FactoryObjectStub );
assert.strictEqual( factory.lookup( 'factory-object-stub' ),
oo.FactoryObjectStub );
diff --git a/tests/unit/Registry.test.js b/tests/unit/Registry.test.js
index 91a70c0..b867304 100644
--- a/tests/unit/Registry.test.js
+++ b/tests/unit/Registry.test.js
@@ -2,7 +2,7 @@
QUnit.module( 'Registry' );
- QUnit.test( 'register/unregister', 7, function ( assert ) {
+ QUnit.test( 'register/unregister', function ( assert ) {
var registry = new oo.Registry();
registry.register( 'registry-item-1', 1 );
@@ -22,7 +22,7 @@
} );
- QUnit.test( 'lookup', 6, function ( assert ) {
+ QUnit.test( 'lookup', function ( assert ) {
var registry = new oo.Registry();
registry.register( 'registry-item-1', 1 );
diff --git a/tests/unit/core.test.js b/tests/unit/core.test.js
index 9551d79..493a961 100644
--- a/tests/unit/core.test.js
+++ b/tests/unit/core.test.js
@@ -2,7 +2,7 @@
QUnit.module( 'core' );
- QUnit.test( 'initClass', 1, function ( assert ) {
+ QUnit.test( 'initClass', function ( assert ) {
function Foo() {
}
oo.initClass( Foo );
@@ -10,7 +10,7 @@
assert.deepEqual( Foo.static, {}, 'A "static" property (empty
object) is created' );
} );
- QUnit.test( 'inheritClass', 27, function ( assert ) {
+ QUnit.test( 'inheritClass', function ( assert ) {
var base, child, key, enumKeys;
function InitA() {}
@@ -109,7 +109,7 @@
assert.strictEqual( child.protoB(), 'Child', 'inheritance is
live (overwriting an inherited method)' );
} );
- QUnit.test( 'mixinClass', 8, function ( assert ) {
+ QUnit.test( 'mixinClass', function ( assert ) {
var obj;
function Init() {}
@@ -179,7 +179,7 @@
var plainObj, funcObj, arrObj;
function testGetSetProp( type, obj ) {
- QUnit.test( 'getProp( ' + type + ' )', 9, function (
assert ) {
+ QUnit.test( 'getProp( ' + type + ' )', function (
assert ) {
assert.strictEqual(
oo.getProp( obj, 'foo' ),
3,
@@ -227,7 +227,7 @@
);
} );
- QUnit.test( 'setProp( ' + type + ' )', 7, function (
assert ) {
+ QUnit.test( 'setProp( ' + type + ' )', function (
assert ) {
oo.setProp( obj, 'foo', 4 );
assert.strictEqual( 4, obj.foo, 'setting an
existing key with depth 1' );
@@ -282,7 +282,7 @@
testGetSetProp( 'Array', arrObj );
}() );
- QUnit.test( 'cloneObject', 4, function ( assert ) {
+ QUnit.test( 'cloneObject', function ( assert ) {
var myfoo, myfooClone, expected;
function Foo( x ) {
@@ -345,7 +345,7 @@
} );
- QUnit.test( 'getObjectValues', 6, function ( assert ) {
+ QUnit.test( 'getObjectValues', function ( assert ) {
var tmp;
assert.deepEqual(
@@ -405,7 +405,7 @@
);
} );
- QUnit.test( 'compare', 26, function ( assert ) {
+ QUnit.test( 'compare', function ( assert ) {
var x, y, z;
assert.strictEqual(
@@ -626,7 +626,7 @@
);
} );
- QUnit.test( 'compare( Object, Object, Boolean asymmetrical )', 5,
function ( assert ) {
+ QUnit.test( 'compare( Object, Object, Boolean asymmetrical )', function
( assert ) {
var x, y, z, i, depth, compare;
x = {
@@ -700,7 +700,7 @@
}
} );
- QUnit.test( 'copy( source )', 14, function ( assert ) {
+ QUnit.test( 'copy( source )', function ( assert ) {
var simpleObj = { foo: 'bar', baz: 3, quux: null, truth: true,
falsehood: false },
simpleArray = [ 'foo', 3, true, false ],
withObj = [ { bar: 'baz', quux: 3 }, 5, null ],
@@ -811,7 +811,7 @@
} );
- QUnit.test( 'copy( source, Function leafCallback )', 3, function (
assert ) {
+ QUnit.test( 'copy( source, Function leafCallback )', function ( assert
) {
function Cloneable( name ) {
this.name = name;
this.clone = function () {
@@ -855,7 +855,7 @@
);
} );
- QUnit.test( 'copy( source, Function leafCallback, Function nodeCallback
)', 2, function ( assert ) {
+ QUnit.test( 'copy( source, Function leafCallback, Function nodeCallback
)', function ( assert ) {
function Cloneable( name ) {
this.name = name;
this.clone = function () {
@@ -903,7 +903,7 @@
);
} );
- QUnit.test( 'getHash: Basic usage', 7, function ( assert ) {
+ QUnit.test( 'getHash: Basic usage', function ( assert ) {
var tmp, key,
cases = {},
hash = '{"a":1,"b":1,"c":1}',
@@ -986,7 +986,7 @@
);
} );
- QUnit.test( 'getHash: Complex usage', 2, function ( assert ) {
+ QUnit.test( 'getHash: Complex usage', function ( assert ) {
var obj, hash;
obj = {
@@ -1041,7 +1041,7 @@
} );
if ( global.document ) {
- QUnit.test( 'getHash( iframe Object )', 1, function ( assert ) {
+ QUnit.test( 'getHash( iframe Object )', function ( assert ) {
var obj, hash;
QUnit.tmpIframe( function ( iframe, teardown ) {
@@ -1066,7 +1066,7 @@
} );
}
- QUnit.test( 'unique', 6, function ( assert ) {
+ QUnit.test( 'unique', function ( assert ) {
assert.deepEqual(
oo.unique( [] ),
@@ -1106,7 +1106,7 @@
} );
- QUnit.test( 'simpleArrayUnion', 5, function ( assert ) {
+ QUnit.test( 'simpleArrayUnion', function ( assert ) {
assert.deepEqual(
oo.simpleArrayUnion( [] ),
@@ -1145,7 +1145,7 @@
} );
- QUnit.test( 'simpleArrayIntersection', 2, function ( assert ) {
+ QUnit.test( 'simpleArrayIntersection', function ( assert ) {
assert.deepEqual(
oo.simpleArrayIntersection( [], [] ),
@@ -1164,7 +1164,7 @@
} );
- QUnit.test( 'simpleArrayDifference', 2, function ( assert ) {
+ QUnit.test( 'simpleArrayDifference', function ( assert ) {
assert.deepEqual(
oo.simpleArrayDifference( [], [] ),
diff --git a/tests/unit/util.test.js b/tests/unit/util.test.js
index efd1c17..b6debf0 100644
--- a/tests/unit/util.test.js
+++ b/tests/unit/util.test.js
@@ -2,7 +2,7 @@
QUnit.module( 'util' );
- QUnit.test( 'isPlainObject', 17, function ( assert ) {
+ QUnit.test( 'isPlainObject', function ( assert ) {
function Thing() {}
// Plain objects
@@ -41,7 +41,7 @@
} );
if ( global.document ) {
- QUnit.test( 'isPlainObject - browser specific', 7, function (
assert ) {
+ QUnit.test( 'isPlainObject - browser specific', function (
assert ) {
var IframeObject, threw;
assert.strictEqual(
--
To view, visit https://gerrit.wikimedia.org/r/249332
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia96249f3dcad10061702a2f3e1bf4d7fd6cc41ef
Gerrit-PatchSet: 1
Gerrit-Project: oojs/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Mooeypoo <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits