Skip to content

Commit

Permalink
Fix lodash-node unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalton committed Jan 28, 2014
1 parent 093e727 commit d655475
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,6 @@
return result;
}());

/** The `ui` object */
var ui = root.ui || (root.ui = {
'buildPath': filePath,
'loaderPath': '',
'urlParams': {}
});

/** The basename of the Lo-Dash file to test */
var basename = /[\w.-]+$/.exec(filePath)[0];

/** Used to indicate testing a modularized build */
var isModularize = ui.isModularize || /\b(?:commonjs|(index|main)\.js|lodash-(?:amd|node)|modularize|npm)\b/.test([ui.buildPath, ui.urlParams.build, basename]);

/** Detect if testing `npm` modules */
var isNpm = isModularize && /\bnpm\b/.test([ui.buildPath, ui.urlParams.build]);

/** Detect if running in Java */
var isJava = !document && !!root.java;

Expand Down Expand Up @@ -157,15 +141,29 @@
(_.runInContext ? _.runInContext(root) : _)
));

/** Used as the property name for wrapper metadata */
var expando = '__lodash@' + _.VERSION + '__';
try {
filePath = require.resolve(filePath);
} catch(e) { }

/** The `ui` object */
var ui = root.ui || (root.ui = {
'buildPath': filePath,
'loaderPath': '',
'urlParams': {}
});

/** The basename of the Lo-Dash file to test */
var basename = _.result(/[\w.-]+$/.exec(filePath), 0, '');

/** Used to pass falsey values to methods */
var falsey = [, '', 0, false, NaN, null, undefined];

/** Used to pass empty values to methods */
var empties = [[], {}].concat(falsey.slice(1));

/** Used as the property name for wrapper metadata */
var expando = '__lodash@' + _.VERSION + '__';

/** Used to set property descriptors */
var defineProperty = (function() {
try {
Expand All @@ -176,6 +174,12 @@
return result;
}());

/** Used to indicate testing a modularized build */
var isModularize = ui.isModularize || /\b(?:commonjs|(index|main)\.js|lodash-(?:amd|node)|modularize|npm)\b/.test([ui.buildPath, ui.urlParams.build, basename]);

/** Detect if testing `npm` modules */
var isNpm = isModularize && /\bnpm\b/.test([ui.buildPath, ui.urlParams.build]);

/** Used to check problem JScript properties (a.k.a. the [[DontEnum]] bug) */
var shadowedProps = [
'constructor',
Expand Down

0 comments on commit d655475

Please sign in to comment.