Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReferenceError: Can't find variable: define at ... with 'grunt test' using jasmine in require.js

I'm a little confused. In my little project I'm using Jasmine, Require.js, Phantomjs and Grunt (all these via Yeoman). So when run I grunt test in the terminal, I get the error:

>> ReferenceError: Can't find variable: define at 
>> test/spec/testSpec.js:15

Warning: No specs executed, is there a configuration error? Use --force to continue.

Aborted due to warnings.

But when I perform the test in a browser, the test goes fine...

Here's my simple test spec:

define(['spec/test'], function(Test) {

  describe('Test for unit-test', function() {
    describe('Test namespace', function() {
      it('should be defined', function() {
        expect(Test).toBeDefined();
      });
    });
  });

});

Module:

define([], function () {
  var Test = {};

  return Test;
});

Can someone help me solve this, please?

Many thanks

like image 849
Shaoz Avatar asked Nov 11 '22 04:11

Shaoz


1 Answers

It seems Grunt doesn't load RequireJS. Maybe this could help you.

like image 58
Razem Avatar answered Nov 14 '22 21:11

Razem