From 9a935ba90c085e82bb4f1743776465ecc46c8db1 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 31 Jul 2013 23:58:22 -0700 Subject: [PATCH] Avoid tests not relevant to modularized builds when its selected. Former-commit-id: 3e0e4275cfa51fc12ea9583801459588658de702 --- test/test.js | 68 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 23 deletions(-) diff --git a/test/test.js b/test/test.js index 488181542..94145123d 100644 --- a/test/test.js +++ b/test/test.js @@ -100,6 +100,9 @@ 'urlParams': {} }); + /** Used to indicate testing a modularized build */ + var isModularize = /modularize/.test(ui.urlParams.build); + /*--------------------------------------------------------------------------*/ /** @@ -133,8 +136,7 @@ // add web worker (function() { - if (!Worker || /modularize/.test(ui.urlParams.build)) { - _._VERSION = _.VERSION; + if (!Worker || isModularize) { return; } var worker = new Worker('./worker.js'); @@ -177,7 +179,7 @@ }); asyncTest('supports loading ' + basename + ' in a web worker', function() { - if (Worker) { + if (Worker && !isModularize) { var limit = 1000, start = new Date; @@ -1607,39 +1609,59 @@ indexOf = _.indexOf; test('`_.contains` should work with a custom `_.indexOf` method', function() { - _.indexOf = custom; - ok(_.contains(array, new Foo)); - _.indexOf = indexOf; + if (!isModularize) { + _.indexOf = custom; + ok(_.contains(array, new Foo)); + _.indexOf = indexOf; + } else { + skipTest(); + } }); test('`_.difference` should work with a custom `_.indexOf` method', function() { - _.indexOf = custom; - deepEqual(_.difference(array, [new Foo]), [1, 3]); - _.indexOf = indexOf; + if (!isModularize) { + _.indexOf = custom; + deepEqual(_.difference(array, [new Foo]), [1, 3]); + _.indexOf = indexOf; + } else { + skipTest(); + } }); test('`_.intersection` should work with a custom `_.indexOf` method', function() { - _.indexOf = custom; - deepEqual(_.intersection(array, [new Foo]), [array[1]]); - _.indexOf = indexOf; + if (!isModularize) { + _.indexOf = custom; + deepEqual(_.intersection(array, [new Foo]), [array[1]]); + _.indexOf = indexOf; + } else { + skipTest(); + } }); test('`_.omit` should work with a custom `_.indexOf` method', function() { - _.indexOf = custom; - deepEqual(_.omit(array, ['x']), { '0': 1, '2': 3 }); - _.indexOf = indexOf; + if (!isModularize) { + _.indexOf = custom; + deepEqual(_.omit(array, ['x']), { '0': 1, '2': 3 }); + _.indexOf = indexOf; + } else { + skipTest(); + } }); test('`_.uniq` should work with a custom `_.indexOf` method', function() { - _.indexOf = custom; - deepEqual(_.uniq(array), array.slice(0, 3)); + if (!isModularize) { + _.indexOf = custom; + deepEqual(_.uniq(array), array.slice(0, 3)); - var largeArray = _.times(largeArraySize, function() { - return new Foo; - }); + var largeArray = _.times(largeArraySize, function() { + return new Foo; + }); - deepEqual(_.uniq(largeArray), [largeArray[0]]); - _.indexOf = indexOf; + deepEqual(_.uniq(largeArray), [largeArray[0]]); + _.indexOf = indexOf; + } else { + skipTest(2); + } }); }()); @@ -3753,7 +3775,7 @@ test('should correctly consume it\'s output', function() { var expected = [['moe', 'larry'], [30, 40]]; - deepEqual(_.unzip(_.zip(_.unzip(_.zip(expected)))), expected); + deepEqual(_.zip(_.zip(_.zip(_.zip(expected)))), expected); }); }());