diff --git a/test/index.html b/test/index.html index a0faa2841..f4c06fb07 100644 --- a/test/index.html +++ b/test/index.html @@ -186,48 +186,55 @@ var reBasename = /[\w.-]+$/, basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''), modulePath = ui.buildPath.replace(/\.js$/, ''), - locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''), moduleMain = modulePath.match(reBasename)[0], + locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''), + shimmedLocationPath = './abc/../' + locationPath, + underscoreLocationPath = './xyz/../' + locationPath, uid = +new Date; function getConfig() { - return { + var result = { 'baseUrl': './', 'urlArgs': 't=' + uid++, 'waitSeconds': 0, - 'packages': [ - { - 'name': 'lodash', - 'location': locationPath, - 'main': moduleMain - }, - { - 'name': 'shimmed', - 'location': './abc/../' + locationPath, - 'main': moduleMain - }, - { - 'name': 'underscore', - 'location': './xyz/../' + locationPath, - 'main': moduleMain - }, - { - 'name': 'test', - 'location': basePath + 'test', - 'main': 'test', - 'config': { - // work around no global being exported - 'exports': 'QUnit', - 'loader': 'curl/loader/legacy' - } + 'paths': {}, + 'packages': [{ + 'name': 'test', + 'location': basePath + 'test', + 'main': 'test', + 'config': { + // work around no global being exported + 'exports': 'QUnit', + 'loader': 'curl/loader/legacy' } - ], + }], 'shim': { 'shimmed': { '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() { diff --git a/test/underscore.html b/test/underscore.html index f9157886e..e97f41a76 100644 --- a/test/underscore.html +++ b/test/underscore.html @@ -151,27 +151,32 @@ uid = +new Date; function getConfig() { - return { + var result = { 'baseUrl': './', 'urlArgs': 't=' + uid++, 'waitSeconds': 0, - 'packages': [ - { - 'name': moduleId, - 'location': locationPath, - 'main': moduleMain - }, - { - 'name': 'test', - 'location': '../vendor/underscore/test', - 'config': { - // work around no global being exported - 'exports': 'QUnit', - 'loader': 'curl/loader/legacy' - } + 'paths': {}, + 'packages': [{ + 'name': 'test', + 'location': '../vendor/underscore/test', + 'config': { + // work around no global being exported + 'exports': 'QUnit', + '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;