https://bl.ocks.org/jayrgee/fa0e752bf5616c437d3e6800503e8d46
-
-
Save jayrgee/fa0e752bf5616c437d3e6800503e8d46 to your computer and use it in GitHub Desktop.
Demo of using Mocha + Chai in a browser without Node
This file contains 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
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Mocha Tests</title> | |
<link href="https://cdnjs.cloudflare.com/ajax/libs/mocha/5.0.0/mocha.css" rel="stylesheet" /> | |
</head> | |
<body> | |
<div id="mocha"></div> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/5.0.0/mocha.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/chai/4.1.2/chai.js"></script> | |
<script>mocha.setup('bdd')</script> | |
<script> | |
var assert = chai.assert; | |
describe('Browser demo', function() { | |
it('should work', function() { | |
assert.equal(1, 1); | |
}); | |
it('should fail', function() { | |
assert.equal(3, 4); | |
}); | |
}); | |
</script> | |
<script> | |
mocha.checkLeaks(); | |
mocha.run(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment