2

First off, I saw this post and it gave me more errors (see bottom).

I get these error:

ReferenceError: Can't find variable: require at test/spec/test.js:1

TypeError: 'undefined' is not an object (evaluating 'text.replace') at bower_components/underscore/underscore.js:1180 src/js/script.js:12 src/js/script.js:56 src/js/script.js:194

ReferenceError: Can't find variable: require at test/spec/test.js:1

When trying to use Grunt.

Here is my Grunt file:

module.exports = function (grunt) {
jasmine: {
            src: 'src/js/*.js',
            options: {
                specs: 'test/spec/*.js',
                helpers: 'test/spec/*.js',
                vendor: [
                    'bower_components/jquery/jquery.js',
                    'bower_components/underscore/underscore.js',
                    'bower_components/backbone/backbone.js'
                ]
            }
        }
    });

grunt.registerTask('default', ['clean', 'jasmine']);

Here is my Test file:

var chai = require('chai')
var Backbone = require('backbone');
var _ = require('underscore');
describe('Underscore & Backbone to be defined', function() {
    it('should be loaded', function() {
        chai.should.exist(_);
        chai.should.exist(Backbone);
    })
})

I am not using requirejs by the way.


When adding grunt-template-jasmine-requirejs, enter code hereI get these errors:

>> Error: Module name "jquery" has not been loaded yet for context: _. Use require([])

>> http://requirejs.org/docs/errors.html#notloaded at

>> .grunt/grunt-contrib-jasmine/require.js:8 aa

>> .grunt/grunt-contrib-jasmine/require.js:12 v

>> .grunt/grunt-contrib-jasmine/require.js:26 h

>> .grunt/grunt-contrib-jasmine/require.js:31

>> test/spec/test.js:1

>> TypeError: 'undefined' is not an object (evaluating 'text.replace') at

>> bower_components/underscore/underscore.js:1180

>> src/js/script.js:12

>> src/js/script.js:56

>> src/js/script.js:194

>> Error: notloaded: Module name "jquery" has not been loaded yet for context: _. Use require([])

>> http://requirejs.org/docs/errors.html#notloaded at

>> _SpecRunner.html:46

>> .grunt/grunt-contrib-jasmine/require.js:12 v

>> .grunt/grunt-contrib-jasmine/require.js:26 h

>> .grunt/grunt-contrib-jasmine/require.js:31

>> test/spec/test.js:1

BenG
  • 14,826
  • 5
  • 45
  • 60
user2874945
  • 308
  • 7
  • 16

0 Answers0