Skip to content

Instantly share code, notes, and snippets.

@JamesMaroney
Created May 12, 2011 21:19
Show Gist options
  • Save JamesMaroney/969473 to your computer and use it in GitHub Desktop.
Save JamesMaroney/969473 to your computer and use it in GitHub Desktop.
jasmine with requirejs
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
<title>Jasmine suite</title>
<link rel="stylesheet" href="/__JASMINE_ROOT__/lib/jasmine.css" type="text/css" media="screen"/>
<script src="/__JASMINE_ROOT__/lib/jasmine.js" type="text/javascript"></script>
<script src="/__JASMINE_ROOT__/lib/jasmine-html.js" type="text/javascript"></script>
<script src="/__JASMINE_ROOT__/lib/json2.js" type="text/javascript"></script>
<!-- These two lines have been pulled above the inline jasmine kick-off code -->
<script src="/js/require.js" type="text/javascript"></script>
<script src="/__spec__/helpers/RequirejsHelper.js" type="text/javascript"></script>
<script type="text/javascript">
var jsApiReporter;
function startJasmine(){
var jasmineEnv = jasmine.getEnv();
jsApiReporter = new jasmine.JsApiReporter();
var trivialReporter = new jasmine.TrivialReporter();
jasmineEnv.addReporter(jsApiReporter);
jasmineEnv.addReporter(trivialReporter);
jasmineEnv.specFilter = function(spec) {
return trivialReporter.specFilter(spec);
};
jasmineEnv.execute();
}
// Now, instead of putting a <script> entry for each found spec file,
// we'll add a dependency to this require statement. The inner require.ready
// should only fire once those dependencies have loaded and executed.
require(["./spec/javascripts/views/signin/indexSpec.js"],function(){
require.ready(function(){
startJasmine();
})
});
</script>
</head>
<body>
<div id="jasmine_content"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment