mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Dynamically create absolute path in test runners.
Former-commit-id: b6b7daef445b3750e687b3559966def1f2b165d3
This commit is contained in:
@@ -53,17 +53,20 @@
|
|||||||
if (!window.require) {
|
if (!window.require) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var modulePath = ui.buildPath.replace(/\.js$/, ''),
|
var reBasename = /[\w.-]+$/,
|
||||||
reBasename = /[\w.-]+$/;
|
basePath = (location.origin + location.pathname).split(/\btest\b/).slice(0, -1).join('test'),
|
||||||
|
modulePath = ui.buildPath.replace(/\.js$/, ''),
|
||||||
|
moduleMain = modulePath.match(reBasename)[0];
|
||||||
|
|
||||||
var locationPath = /modularize/.test(ui.urlParams.build)
|
var locationPath = /modularize/.test(ui.urlParams.build)
|
||||||
? '../modularize'
|
? '../modularize'
|
||||||
: modulePath.replace(reBasename, '');
|
: modulePath.replace(reBasename, '');
|
||||||
|
|
||||||
var testPath = (
|
var pluginPath = window.curl
|
||||||
(window.curl ? ui.loaderPath.replace(reBasename, 'curl/plugin/js!') : '') +
|
? ui.loaderPath.replace(reBasename, 'curl/plugin/js!')
|
||||||
'test.js'
|
: '';
|
||||||
);
|
|
||||||
|
var testPath = pluginPath + basePath + '/test/test.js';
|
||||||
|
|
||||||
QUnit.config.autostart = false;
|
QUnit.config.autostart = false;
|
||||||
|
|
||||||
@@ -83,7 +86,7 @@
|
|||||||
{
|
{
|
||||||
'name': 'lodash',
|
'name': 'lodash',
|
||||||
'location': locationPath,
|
'location': locationPath,
|
||||||
'main': 'lodash'
|
'main': moduleMain
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'shim': {
|
'shim': {
|
||||||
|
|||||||
@@ -107,8 +107,10 @@
|
|||||||
init(_);
|
init(_);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var modulePath = ui.buildPath.replace(/\.js$/, ''),
|
var reBasename = /[\w.-]+$/,
|
||||||
reBasename = /[\w.-]+$/;
|
basePath = (location.origin + location.pathname).split(/\btest\b/).slice(0, -1).join('test'),
|
||||||
|
modulePath = ui.buildPath.replace(/\.js$/, ''),
|
||||||
|
moduleMain = modulePath.match(reBasename)[0];
|
||||||
|
|
||||||
var locationPath = /modularize/.test(ui.urlParams.build)
|
var locationPath = /modularize/.test(ui.urlParams.build)
|
||||||
? '../modularize'
|
? '../modularize'
|
||||||
@@ -128,18 +130,18 @@
|
|||||||
{
|
{
|
||||||
'name': 'lodash',
|
'name': 'lodash',
|
||||||
'location': locationPath,
|
'location': locationPath,
|
||||||
'main': 'lodash'
|
'main': moduleMain
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
['lodash'], function(lodash) {
|
['lodash'], function(lodash) {
|
||||||
init(lodash);
|
init(lodash);
|
||||||
require([
|
require([
|
||||||
pluginPath + '/vendor/underscore/test/collections.js',
|
pluginPath + basePath + '/vendor/underscore/test/collections.js',
|
||||||
pluginPath + '/vendor/underscore/test/arrays.js',
|
pluginPath + basePath + '/vendor/underscore/test/arrays.js',
|
||||||
pluginPath + '/vendor/underscore/test/functions.js',
|
pluginPath + basePath + '/vendor/underscore/test/functions.js',
|
||||||
pluginPath + '/vendor/underscore/test/objects.js',
|
pluginPath + basePath + '/vendor/underscore/test/objects.js',
|
||||||
pluginPath + '/vendor/underscore/test/utility.js'
|
pluginPath + basePath + '/vendor/underscore/test/utility.js'
|
||||||
], function() {
|
], function() {
|
||||||
QUnit.start();
|
QUnit.start();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user