It seems that there are a number of posts grappling with Jasmine 1.3 and Requirejs, but I'm having trouble with 2.0. I am using Jasmine 2.0 for tests, requirejs for AMD compliance and testr to mock some of my modules in my tests.
When I open the page, however, it's blank with nothing in the console.
You can see the project in full at https://github.com/nopwd/client if that's more helpful.
I have a test.html page set up:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>NoPwd Testing Rig</title>
<link type="text/css" rel="stylesheet" href="lib/jasmine/lib/jasmine-core/jasmine.css" />
</head>
<body>
<script language="javascript" type="text/javascript" src="lib/requirejs/require.js"></script>
<script language="javascript" type="text/javascript" src="lib/testr.js/testr.js"></script>
<script language="javascript" type="text/javascript">
testr.config({
root: './',
baseUrl: './',
ignore: ['lodash']
});
testr.run('test.js', function() {});
</script>
</body>
</html>
I also have a test.js file which is the entry point:
require.config({
paths: {
// ...
},
shim: {
'jasmine/jasmine': {
exports: 'window.jasmineRequire'
},
'jasmine/jasmine-html': {
deps: ['jasmine/jasmine'],
exports: 'window.jasmineRequire'
},
'jasmine/boot': {
deps: ['jasmine/jasmine', 'jasmine/jasmine-html'],
exports: 'window.jasmineRequire'
},
'jasmine-ajax': {
deps: ['jasmine/jasmine', 'jasmine/boot'],
exports: 'window.jasmineRequire'
}
}
});
require(
[
'jasmine/jasmine-html', 'jasmine/boot', 'jasmine-ajax',
'spec/nopwd-spec', 'spec/hash-spec', 'spec/transport-spec'
],
function() {
'use strict';
}
);
I know for previous Jasmine versions you'd have to call jasmine.getEnv().execute()
but it doesn't seem to be the case with 2.0.