RequireJS 'sugar' syntax results in unresolved Jasmine methods

Hi,

The code below results in Jasmine's describe() having an 'unresolved function or method describe()' error:

define(function(require) {

    var test = require('test');

    describe('displayLegend', function() {

    });

});


But if I comment out the usage of require(), the error goes away:

define(function(require) {

//    var test = require('test');

    describe('displayLegend', function() {

    });

});


Loading dependencies with the standard requirejs synax will also work fine:

define(['test'], function(test) {

    describe('displayLegend', function() {

    });

});


I, like many other people, prefer the first example's 'sugar' syntax, but it appears that something within Webstorm is conflicting with the usage of require();


In my preferences/JavaScript/Libraries, I have both requirejs and jasmine added as global.  I have also checked 'Node.js Globals'.

Anyone know why this is happening?  I'm wondering if this is a bug, or maybe an err on my own part.

3 comments
Comment actions Permalink

Hey Elena,

Thanks, that link explains the behavior.  I was originally hoping to make all jasmine-related dependencies implicit, but it appears that this is the correct behavior.

When you say vote for the link, do you mean mark your post as the answer to this thread?  I'd like to, but I can't seem to find the option to do so.

Thanks!

0
Comment actions Permalink

No, I meant voting for the youtrack bug. Please refer to https://jetbrains.zendesk.com/entries/23368682 for more information

0

Please sign in to leave a comment.