From 9b22748bd0cee6f7ab9358bdd0860853f2272edc Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 24 Feb 2013 15:25:56 -0800 Subject: [PATCH] Cleanup perf/perf.js and test/test.js. Former-commit-id: fba43c75aa25227e771a3cdd0cce0ee8ee9cdba6 --- perf/perf.js | 8 +++++--- test/test.js | 21 ++++++++++++--------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/perf/perf.js b/perf/perf.js index 4ff9cf5bc..ece6f3e4d 100644 --- a/perf/perf.js +++ b/perf/perf.js @@ -14,7 +14,9 @@ ); var last = result[result.length - 1]; - result = (result.length > min && last != 'test.js') ? last : '../lodash.js'; + result = (result.length > min && !/test(?:\.js)?$/.test(last)) + ? last + : '../lodash.js'; try { result = require('fs').realpathSync(result); @@ -55,10 +57,10 @@ var suites = []; /** The `ui` object */ - var ui = window.ui || { + var ui = window.ui || ({ 'buildPath': basename(filePath, '.js'), 'otherPath': 'underscore' - }; + }); /** The Lo-Dash build basename */ var buildName = basename(ui.buildPath, '.js'); diff --git a/test/test.js b/test/test.js index 810898b67..84583b37e 100644 --- a/test/test.js +++ b/test/test.js @@ -15,7 +15,9 @@ ); var last = result[result.length - 1]; - result = (result.length > min && last != 'test.js') ? last : '../lodash.js'; + result = (result.length > min && !/test(?:\.js)?$/.test(last)) + ? last + : '../lodash.js'; try { return require('fs').realpathSync(result); @@ -28,10 +30,11 @@ var basename = /[\w.-]+$/.exec(filePath)[0]; /** The `platform` object to check */ - var platform = + var platform = ( window.platform || load('../vendor/platform.js/platform.js') || - window.platform; + window.platform + ); /** The unit testing framework */ var QUnit = (function() { @@ -47,12 +50,12 @@ }()); /** The `lodash` function to test */ - var _ = window._ || ( - _ = load(filePath) || window._, - _._ || _ - ); - - _ = _.runInContext(window); + var _ = + window._ || ( + _ = load(filePath) || window._, + _ = _._ || _, + _.runInContext(window) + ); /** Used to pass falsey values to methods */ var falsey = [