Skip to content

Instantly share code, notes, and snippets.

@sorin-postelnicu
Last active March 12, 2018 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sorin-postelnicu/02ca666b8ac17adc5e614db5dc9730c5 to your computer and use it in GitHub Desktop.
Save sorin-postelnicu/02ca666b8ac17adc5e614db5dc9730c5 to your computer and use it in GitHub Desktop.
Uncaught Error when trying to use jasmine-expect with jasmine2 and requirejs
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Jasmine Spec Runner v2.4.1</title>
<link rel="stylesheet" href="../lib/jasmine_2.4.1/jasmine.css">
<script data-main="specs.main" src="../lib/requirejs/require.min.js"></script>
</head>
<body>
</body>
</html>
define(function(require) {
var jquery = require('jquery');
describe('Example spec', function() {
describe('type', function() {
it('should be array', function() {
var a = [];
expect(a).toBeArray();
});
});
});
});
requirejs.config({
paths: {
app: '../app',
jquery: '../lib/jquery/jquery.min',
modernizr: '../lib/modernizr/modernizr-custom.min',
localStorage: '../lib/localStorage/localStorage',
jasmine: ['../lib/jasmine_2.4.1/jasmine'],
'jasmine-html': ['../lib/jasmine_2.4.1/jasmine-html'],
'jasmine-boot': ['../lib/jasmine_2.4.1/boot'],
'jasmine-jquery': ['../lib/jasmine-jquery/lib/jasmine-jquery'],
'jasmine-ajax': ['../lib/jasmine-ajax/lib/mock-ajax'],
'jasmine-add-matchers': ['../lib/jasmine-add-matchers/dist/add-matchers'],
'jasmine-expect': ['../lib/jasmine-expect/dist/jasmine-matchers']
},
shim: {
'modernizr': {},
'jasmine-html': {
deps: ['jasmine']
},
'jasmine-boot': {
deps: ['jasmine', 'jasmine-html']
},
'jasmine-jquery': {
deps: ['jasmine', 'jasmine-html', 'jasmine-boot', 'jquery']
},
'jasmine-ajax': {
deps: ['jasmine', 'jasmine-html', 'jasmine-boot']
},
'jasmine-add-matchers': {
deps: ['jasmine']
},
'jasmine-expect': {
deps: ['jasmine', 'jasmine-add-matchers']
}
}
});
require(['jasmine', 'jasmine-boot', 'jasmine-html', 'jasmine-add-matchers', 'jasmine-expect', 'jasmine-jquery', 'jasmine-ajax'], function() {
require([
'app/mymodule/mycomponent.spec',
'app/myothermodule/myothercomponent.spec'
], function() {
window.onload();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment