Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intern configuration not processing AMD shim

Tags:

intern

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?

like image 709
coreyschram Avatar asked May 07 '13 20:05

coreyschram


Video Answer


1 Answers

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.

like image 115
Kitson Avatar answered Sep 18 '22 08:09

Kitson