mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Fix lodash-node unit tests.
This commit is contained in:
40
test/test.js
40
test/test.js
@@ -55,22 +55,6 @@
|
|||||||
return result;
|
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 */
|
/** Detect if running in Java */
|
||||||
var isJava = !document && !!root.java;
|
var isJava = !document && !!root.java;
|
||||||
|
|
||||||
@@ -157,8 +141,19 @@
|
|||||||
(_.runInContext ? _.runInContext(root) : _)
|
(_.runInContext ? _.runInContext(root) : _)
|
||||||
));
|
));
|
||||||
|
|
||||||
/** Used as the property name for wrapper metadata */
|
try {
|
||||||
var expando = '__lodash@' + _.VERSION + '__';
|
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 */
|
/** Used to pass falsey values to methods */
|
||||||
var falsey = [, '', 0, false, NaN, null, undefined];
|
var falsey = [, '', 0, false, NaN, null, undefined];
|
||||||
@@ -166,6 +161,9 @@
|
|||||||
/** Used to pass empty values to methods */
|
/** Used to pass empty values to methods */
|
||||||
var empties = [[], {}].concat(falsey.slice(1));
|
var empties = [[], {}].concat(falsey.slice(1));
|
||||||
|
|
||||||
|
/** Used as the property name for wrapper metadata */
|
||||||
|
var expando = '__lodash@' + _.VERSION + '__';
|
||||||
|
|
||||||
/** Used to set property descriptors */
|
/** Used to set property descriptors */
|
||||||
var defineProperty = (function() {
|
var defineProperty = (function() {
|
||||||
try {
|
try {
|
||||||
@@ -176,6 +174,12 @@
|
|||||||
return result;
|
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) */
|
/** Used to check problem JScript properties (a.k.a. the [[DontEnum]] bug) */
|
||||||
var shadowedProps = [
|
var shadowedProps = [
|
||||||
'constructor',
|
'constructor',
|
||||||
|
|||||||
Reference in New Issue
Block a user