Created
August 31, 2012 19:14
-
-
Save acthp/3557646 to your computer and use it in GitHub Desktop.
requirejs (AMD) loader plugin for jstestdriver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var loadSource = function(file, onSourceLoad) { | |
if (!file.fileSrc.match(/js-test/)) { | |
return false; | |
} | |
require([file.fileSrc], function() { | |
onSourceLoad({file: file, success: true, message: ''}); | |
}, function(err) { | |
var msg = err.requireType; | |
if (err.requireModules) { | |
msg += ": " + err.requireModules.join(', '); | |
} | |
onSourceLoad({file: file, success: false, message: msg}); | |
}); | |
return true; | |
}; | |
jstestdriver.pluginRegistrar.register({ | |
name: 'AMDLoaderPlugin', | |
loadSource: loadSource | |
}); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The easiest workaround I've found for this is to just put explicit module names inside each of my
define()
calls.