Created
May 30, 2014 14:34
-
-
Save leegee/cb59872f7bbf35ddfba8 to your computer and use it in GitHub Desktop.
Client-side Require.js and Mocha.js Runner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Mocha Test Suite Runner</title> | |
<link rel="stylesheet" media="all" href="vendor/mocha/mocha.css"> | |
<script src='../vendor/require.js'></script> | |
<script> | |
/** Needed to run the tests */ | |
var PRE_LIBS = [ | |
'vendor/mocha/mocha.js', | |
'vendor/chai/chai.js', | |
'vendor/should/should.js' | |
]; | |
/** The tests themselves */ | |
var TEST_SPECS = [ | |
'examples/simple.js', | |
'examples/ajax.js' | |
]; | |
require(['../require-global-config.js'], function(){ | |
require( PRE_LIBS, function(){ | |
mocha.setup('bdd'); | |
require( TEST_SPECS, function (m){ | |
// mocha.globals(['jQuery', '$']); | |
// mocha.checkLeaks(); | |
mocha.run(); | |
}); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<header> | |
<h1>Mocha Tests</h1> | |
<p>Add tests to this file's <code>TEST_SPECS</code>.</p> | |
</header> | |
<section id="mocha" data-comment="Report gets inserted into here"></section> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment