Allow switching the module loader in the unit tests.

Former-commit-id: 8521e92925cbca8ff73adf3f1a350caa662e27f7
This commit is contained in:
John-David Dalton
2013-07-07 16:24:26 -07:00
parent b1b06a38af
commit 9b21656314
4 changed files with 74 additions and 36 deletions

View File

@@ -32,7 +32,7 @@
: '../lodash.js';
try {
return require('fs').realpathSync(result);
return global.require('fs').realpathSync(result);
} catch(e) {
return result;
}
@@ -99,6 +99,11 @@
/** Used to check problem JScript properties too */
var shadowedObject = _.invert(shadowedProps);
/** The `ui` object */
var ui = window.ui || (window.ui = {
'loaderPath': ''
});
/*--------------------------------------------------------------------------*/
/**
@@ -146,7 +151,7 @@
});
test('supports loading ' + basename + ' with the Require.js "shim" configuration option', function() {
if (amd) {
if (amd && /requirejs/.test(ui.loaderPath)) {
equal((shimmedModule || {}).moduleName, 'shimmed');
} else {
skipTest();
@@ -154,7 +159,7 @@
});
test('supports loading ' + basename + ' as the "underscore" module', function() {
if (amd) {
if (amd && !/dojo/.test(ui.loaderPath)) {
equal((underscoreModule || {}).moduleName, 'underscore');
} else {
skipTest();