diff --git a/test/index.html b/test/index.html
index fd5b5577b..a04fcf54d 100644
--- a/test/index.html
+++ b/test/index.html
@@ -53,56 +53,44 @@
if (!window.require) {
return;
}
- var isModularize = /modularize/.test(ui.urlParams.build);
+ var modulePath = ui.buildPath.replace(/\.js$/, ''),
+ reBasename = /[\w.-]+$/;
- var baseUrl = isModularize
- ? '../modularize/'
- : '';
-
- var modulePath = isModularize
- ? 'lodash'
- : ui.buildPath.replace(/\.js$/, '');
+ var locationPath = /modularize/.test(ui.urlParams.build)
+ ? '../modularize'
+ : modulePath.replace(reBasename, '');
var testPath = (
- (window.curl ? ui.loaderPath.replace(/[\w.-]+$/, 'curl/plugin/js!') : '') +
- (isModularize ? '../test/' : '') +
+ (window.curl ? ui.loaderPath.replace(reBasename, 'curl/plugin/js!') : '') +
'test.js'
);
QUnit.config.autostart = false;
- var paths = {
- 'shimmed': './abc/../' + modulePath,
- 'underscore': './xyz/../' + modulePath
- };
-
- var packages = [];
-
- if (isModularize) {
- packages.push({
- 'name': 'lodash',
- 'location': '.',
- 'main': 'lodash'
- });
- } else {
- paths.lodash = modulePath;
- }
-
// load Lo-Dash as a module
require({
- 'baseUrl': baseUrl,
+ 'baseUrl': './',
'urlArgs': 't=' + (+new Date),
- 'paths': paths,
+ 'paths': {
+ 'shimmed': './abc/../' + modulePath,
+ 'underscore': './xyz/../' + modulePath
+ },
'aliases': [
['shimmed', 'lodash'],
['underscore', 'lodash']
],
+ 'packages': [
+ {
+ 'name': 'lodash',
+ 'location': locationPath,
+ 'main': 'lodash'
+ }
+ ],
'shim': {
'shimmed': {
'exports': '_'
}
- },
- 'packages': packages
+ }
},
['lodash', 'shimmed', 'underscore'], function(lodash, shimmed, underscore) {
if (shimmed && shimmed.noConflict) {
diff --git a/test/underscore.html b/test/underscore.html
index a515c6e86..028884d06 100644
--- a/test/underscore.html
+++ b/test/underscore.html
@@ -102,44 +102,49 @@
if (window.curl) {
var require = curl;
}
- if (!window.require) {
- init(_);
- } else {
+ (function() {
+ if (!window.require) {
+ init(_);
+ return;
+ }
+ var modulePath = ui.buildPath.replace(/\.js$/, ''),
+ reBasename = /[\w.-]+$/;
+
+ var locationPath = /modularize/.test(ui.urlParams.build)
+ ? '../modularize'
+ : modulePath.replace(reBasename, '');
+
+ var pluginPath = window.curl
+ ? ui.loaderPath.replace(reBasename, 'curl/plugin/js!')
+ : '';
+
QUnit.config.autostart = false;
// load Lo-Dash as a module
- require((function() {
- var reModularize = /modularize/;
-
- var baseUrl = reModularize.test(ui.urlParams.build)
- ? '../modularize/'
- : '';
-
- var modulePath = reModularize.test(ui.urlParams.build)
- ? 'lodash'
- : ui.buildPath.replace(/\.js$/, '');
-
- return {
- 'baseUrl': baseUrl,
- 'urlArgs': 't=' + (+new Date),
- 'paths': {
- 'lodash': modulePath
+ require({
+ 'baseUrl': './',
+ 'urlArgs': 't=' + (+new Date),
+ 'packages': [
+ {
+ 'name': 'lodash',
+ 'location': locationPath,
+ 'main': 'lodash'
}
- };
- }()),
+ ]
+ },
['lodash'], function(lodash) {
init(lodash);
require([
- '../vendor/underscore/test/collections.js',
- '../vendor/underscore/test/arrays.js',
- '../vendor/underscore/test/functions.js',
- '../vendor/underscore/test/objects.js',
- '../vendor/underscore/test/utility.js'
+ pluginPath + '../vendor/underscore/test/collections.js',
+ pluginPath + '../vendor/underscore/test/arrays.js',
+ pluginPath + '../vendor/underscore/test/functions.js',
+ pluginPath + '../vendor/underscore/test/objects.js',
+ pluginPath + '../vendor/underscore/test/utility.js'
], function() {
QUnit.start();
});
});
- }
+ }());