Intern configuration not processing AMD shim
I am trying to test a Require.js project using Intern. I'm running into errors in my tests where jQuery is not defined when jQuery plugins are being loaded. My loader config looks like this:
loader: {
// Aliased paths
paths: {
'dt': 'dt',
'jq': 'jquery',
'jquery': 'jquery/jquery-1.8.3',
'jquerymx': 'jquery/jquerymx-3.2.custom',
'jquery.ui': 'jquery/jquery-ui-1.9.2.custom.min',
'jquery.ui.widget': 'jquery/jquery.ui.widget',
'jquery.jscrollpane': 'jquery/jquery.jscrollpane.min.edit',
'jquery.colorbox': 'jquery/jquery.colorbox-min',
'jquery.selectbox': 'jquery/jquery.selectbox-0.2.min.edit',
'jquery.base64': 'jquery/jquery.base64',
'jquery.cookie': 'jquery/jquery.cookie',
'jquery.urldecoder': 'jquery/jquery.urldecoder.min',
'jquery.fileupload': 'jquery/jquery.fileupload',
'jquery.history': 'history/scripts/compressed/history.adapter.jquery',
'openajax': 'openajax_2.0.7/OpenAjaxUnmanagedHub',
'zeroclipboard': 'zeroclipboard/ZeroClipboard'
},
// Plugin mappings
map: {
'*': {
'css': 'requirejs/require-css/css',
'text': 'requirejs/text'
}
},
// Shims for non-AMD libraries, mainly jQuery plugins
shim: {
'openajax': {
exports: 'OpenAjax'
},
'zeroclipboard': {
exports: 'ZeroClipboard'
},
'jquerymx': ['jquery'],
'jquery.ui': ['jquery'],
'jquery.ui.widget': ['jquery'],
'jquery.jscrollpane': ['jquery'],
'jquery.colorbox': ['jquery'],
'jquery.selectbox': ['jquery'],
'jquery.base64': ['jquery'],
'jquery.cookie': ['jquery'],
'jquery.urldecoder': ['jquery'],
'jquery.fileupload': ['jquery'],
'jquery.history': [
'jquery',
'history/scripts/compressed/history',
'history/scripts/compressed/history.html4'
]
}
}
I've checked to make sure jQuery and my other dependencies are actually being loaded, and they are, just not in the right order. Does the Dojo AMD loader that Intern use not handle the shim configuration?
The problem is that the AMD loader used by intern doesn't currently implement the shim
configuration propertyAMD Specification. I was actually unaware that it was part of the standard until you asked this question.
At the moment, you could run functional tests using a different AMD loader via Intern, but at the moment, it would be difficult to run unit tests on the local machine.
All I had to do was point useLoader config to the require.js, and poof. I had the familiar shim config and path config I use in my app. Bam.
链接地址: http://www.djcxy.com/p/71422.html上一篇: Android动画绘制矩形计时器
下一篇: 实习生配置不处理AMD垫片