mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Avoid packages config for monolithic modules in tests.
This commit is contained in:
@@ -186,32 +186,19 @@
|
|||||||
var reBasename = /[\w.-]+$/,
|
var reBasename = /[\w.-]+$/,
|
||||||
basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''),
|
basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''),
|
||||||
modulePath = ui.buildPath.replace(/\.js$/, ''),
|
modulePath = ui.buildPath.replace(/\.js$/, ''),
|
||||||
locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''),
|
|
||||||
moduleMain = modulePath.match(reBasename)[0],
|
moduleMain = modulePath.match(reBasename)[0],
|
||||||
|
locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''),
|
||||||
|
shimmedLocationPath = './abc/../' + locationPath,
|
||||||
|
underscoreLocationPath = './xyz/../' + locationPath,
|
||||||
uid = +new Date;
|
uid = +new Date;
|
||||||
|
|
||||||
function getConfig() {
|
function getConfig() {
|
||||||
return {
|
var result = {
|
||||||
'baseUrl': './',
|
'baseUrl': './',
|
||||||
'urlArgs': 't=' + uid++,
|
'urlArgs': 't=' + uid++,
|
||||||
'waitSeconds': 0,
|
'waitSeconds': 0,
|
||||||
'packages': [
|
'paths': {},
|
||||||
{
|
'packages': [{
|
||||||
'name': 'lodash',
|
|
||||||
'location': locationPath,
|
|
||||||
'main': moduleMain
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'shimmed',
|
|
||||||
'location': './abc/../' + locationPath,
|
|
||||||
'main': moduleMain
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'underscore',
|
|
||||||
'location': './xyz/../' + locationPath,
|
|
||||||
'main': moduleMain
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'test',
|
'name': 'test',
|
||||||
'location': basePath + 'test',
|
'location': basePath + 'test',
|
||||||
'main': 'test',
|
'main': 'test',
|
||||||
@@ -220,14 +207,34 @@
|
|||||||
'exports': 'QUnit',
|
'exports': 'QUnit',
|
||||||
'loader': 'curl/loader/legacy'
|
'loader': 'curl/loader/legacy'
|
||||||
}
|
}
|
||||||
}
|
}],
|
||||||
],
|
|
||||||
'shim': {
|
'shim': {
|
||||||
'shimmed': {
|
'shimmed': {
|
||||||
'exports': '_'
|
'exports': '_'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (ui.isModularize) {
|
||||||
|
result.packages.push({
|
||||||
|
'name': 'lodash',
|
||||||
|
'location': locationPath,
|
||||||
|
'main': moduleMain
|
||||||
|
}, {
|
||||||
|
'name': 'shimmed',
|
||||||
|
'location': shimmedLocationPath,
|
||||||
|
'main': moduleMain
|
||||||
|
}, {
|
||||||
|
'name': 'underscore',
|
||||||
|
'location': underscoreLocationPath,
|
||||||
|
'main': moduleMain
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
result.paths.lodash = modulePath;
|
||||||
|
result.paths.shimmed = shimmedLocationPath + '/' + moduleMain;
|
||||||
|
result.paths.underscore = underscoreLocationPath + '/' + moduleMain;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadTests() {
|
function loadTests() {
|
||||||
|
|||||||
@@ -151,17 +151,12 @@
|
|||||||
uid = +new Date;
|
uid = +new Date;
|
||||||
|
|
||||||
function getConfig() {
|
function getConfig() {
|
||||||
return {
|
var result = {
|
||||||
'baseUrl': './',
|
'baseUrl': './',
|
||||||
'urlArgs': 't=' + uid++,
|
'urlArgs': 't=' + uid++,
|
||||||
'waitSeconds': 0,
|
'waitSeconds': 0,
|
||||||
'packages': [
|
'paths': {},
|
||||||
{
|
'packages': [{
|
||||||
'name': moduleId,
|
|
||||||
'location': locationPath,
|
|
||||||
'main': moduleMain
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'test',
|
'name': 'test',
|
||||||
'location': '../vendor/underscore/test',
|
'location': '../vendor/underscore/test',
|
||||||
'config': {
|
'config': {
|
||||||
@@ -169,9 +164,19 @@
|
|||||||
'exports': 'QUnit',
|
'exports': 'QUnit',
|
||||||
'loader': 'curl/loader/legacy'
|
'loader': 'curl/loader/legacy'
|
||||||
}
|
}
|
||||||
}
|
}]
|
||||||
]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (ui.isModularize) {
|
||||||
|
result.packages.push({
|
||||||
|
'name': moduleId,
|
||||||
|
'location': locationPath,
|
||||||
|
'main': moduleMain
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
result.paths[moduleId] = modulePath;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUnit.config.autostart = false;
|
QUnit.config.autostart = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user