mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +00:00
Add lodash.min.js support to test.js.
Former-commit-id: c5c6cc47631752862c8f7b3b0f3d7b004493c01b
This commit is contained in:
@@ -47,6 +47,6 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node ./build.js",
|
"build": "node ./build.js",
|
||||||
"test": "node ./test/test.js && node ./test/test-build.js"
|
"test": "node ./test/test.js && node ./test/test.js ./lodash.min.js && node ./test/test-build.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
23
test/test.js
23
test/test.js
@@ -1,6 +1,9 @@
|
|||||||
;(function(window, undefined) {
|
;(function(window, undefined) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
/** The `lodash` basename */
|
||||||
|
var basename = 'lodash.js';
|
||||||
|
|
||||||
/** Use a single load function */
|
/** Use a single load function */
|
||||||
var load = typeof require == 'function' ? require : window.load;
|
var load = typeof require == 'function' ? require : window.load;
|
||||||
|
|
||||||
@@ -21,11 +24,17 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
/** The `lodash` function to test */
|
/** The `lodash` function to test */
|
||||||
var _ =
|
var _ = (function() {
|
||||||
window._ || (
|
try {
|
||||||
_ = load('../lodash.js') || window._,
|
var filePath = require('fs').realpathSync(process.argv[2]);
|
||||||
|
basename = require('path').basename(filePath);
|
||||||
|
} catch(e) { }
|
||||||
|
|
||||||
|
return window._ || (
|
||||||
|
_ = load(filePath || '../lodash.js') || window._,
|
||||||
_._ || _
|
_._ || _
|
||||||
);
|
);
|
||||||
|
}());
|
||||||
|
|
||||||
/** Used to pass falsey values to methods */
|
/** Used to pass falsey values to methods */
|
||||||
var falsey = [
|
var falsey = [
|
||||||
@@ -110,10 +119,10 @@
|
|||||||
|
|
||||||
// explicitly call `QUnit.module()` instead of `module()`
|
// explicitly call `QUnit.module()` instead of `module()`
|
||||||
// in case we are in a CLI environment
|
// in case we are in a CLI environment
|
||||||
QUnit.module('lodash');
|
QUnit.module(basename);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
test('supports loading lodash.js as the "lodash" module', function() {
|
test('supports loading ' + basename + ' as the "lodash" module', function() {
|
||||||
if (window.document && window.require) {
|
if (window.document && window.require) {
|
||||||
equal((lodashModule || {}).moduleName, 'lodash');
|
equal((lodashModule || {}).moduleName, 'lodash');
|
||||||
} else {
|
} else {
|
||||||
@@ -121,7 +130,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('supports loading lodash.js with the Require.js "shim" configuration option', function() {
|
test('supports loading ' + basename + ' with the Require.js "shim" configuration option', function() {
|
||||||
if (window.document && window.require) {
|
if (window.document && window.require) {
|
||||||
equal((shimmedModule || {}).moduleName, 'shimmed');
|
equal((shimmedModule || {}).moduleName, 'shimmed');
|
||||||
} else {
|
} else {
|
||||||
@@ -129,7 +138,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('supports loading lodash.js as the "underscore" module', function() {
|
test('supports loading ' + basename + ' as the "underscore" module', function() {
|
||||||
if (window.document && window.require) {
|
if (window.document && window.require) {
|
||||||
equal((underscoreModule || {}).moduleName, 'underscore');
|
equal((underscoreModule || {}).moduleName, 'underscore');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user