From bd98779b3c0ae5c48f5949c50173df6bb12f654c Mon Sep 17 00:00:00 2001 From: jdalton Date: Wed, 1 Jul 2015 21:17:28 -0700 Subject: [PATCH] Fix test fails related to `root._`. --- test/test.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/test.js b/test/test.js index 4230d5517..defbdb213 100644 --- a/test/test.js +++ b/test/test.js @@ -236,6 +236,9 @@ (_.runInContext ? _.runInContext(root) : _) )); + /** Used to restore the `_` reference. */ + var oldDash = root._; + /** List of latin-1 supplementary letters to basic latin letters. */ var burredLetters = [ '\xc0', '\xc1', '\xc2', '\xc3', '\xc4', '\xc5', '\xc6', '\xc7', '\xc8', '\xc9', '\xca', '\xcb', '\xcc', '\xcd', '\xce', @@ -457,6 +460,7 @@ // Load lodash and expose it to the bad extensions/shims. lodashBizarro = (lodashBizarro = require(filePath))._ || lodashBizarro['default'] || lodashBizarro; + root._ = oldDash; // Restore built-in methods. setProperty(Array, 'isArray', _isArray); @@ -11545,7 +11549,6 @@ (function() { test('should return the `lodash` function', 2, function() { if (!isModularize) { - var oldDash = root._; strictEqual(_.noConflict(), oldDash); if (!(isRhino && typeof require == 'function')) { @@ -18141,8 +18144,7 @@ var acceptFalsey = _.difference(allMethods, rejectFalsey); test('should accept falsey arguments', 229, function() { - var emptyArrays = _.map(falsey, _.constant([])), - oldDash = root._; + var emptyArrays = _.map(falsey, _.constant([])); _.each(acceptFalsey, function(methodName) { var expected = emptyArrays,