mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Add "iife=.." command to build.js.
Former-commit-id: 85d8c7ea550403663a878f2713ce93ae8c2dbc6a
This commit is contained in:
@@ -585,7 +585,8 @@
|
||||
'exports=amd',
|
||||
'exports=commonjs',
|
||||
'exports=global',
|
||||
'exports=node'
|
||||
'exports=node',
|
||||
'exports=none'
|
||||
];
|
||||
|
||||
commands.forEach(function(command, index) {
|
||||
@@ -626,6 +627,11 @@
|
||||
vm.runInContext(source, context);
|
||||
ok(context._ === undefined, basename);
|
||||
ok(_.isFunction(context.module.exports), basename);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
vm.runInContext(source, context);
|
||||
ok(context._ === undefined, basename);
|
||||
}
|
||||
start();
|
||||
});
|
||||
@@ -635,6 +641,30 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('iife command');
|
||||
|
||||
(function() {
|
||||
var start = _.after(2, _.once(QUnit.start));
|
||||
|
||||
asyncTest('`lodash iife=...`', function() {
|
||||
build(['-s', 'iife=!function(window,undefined){%output%}(this)'], function(source, filepath) {
|
||||
var basename = path.basename(filepath, '.js'),
|
||||
context = createContext();
|
||||
|
||||
try {
|
||||
vm.runInContext(source, context);
|
||||
} catch(e) { }
|
||||
|
||||
var lodash = context._ || {};
|
||||
ok(_.isString(lodash.VERSION), basename);
|
||||
ok(/!function/.test(source), basename);
|
||||
start();
|
||||
});
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('output options');
|
||||
|
||||
(function() {
|
||||
@@ -676,7 +706,7 @@
|
||||
(function() {
|
||||
var start = _.once(QUnit.start);
|
||||
|
||||
asyncTest('`minify underscore.js`', function() {
|
||||
asyncTest('`node minify underscore.js`', function() {
|
||||
var source = fs.readFileSync(path.join(__dirname, '..', 'vendor', 'underscore', 'underscore.js'), 'utf8');
|
||||
minify(source, {
|
||||
'silent': true,
|
||||
|
||||
Reference in New Issue
Block a user