Skip to content

Instantly share code, notes, and snippets.

@andyperlitch
Last active December 19, 2015 09:49
Show Gist options
  • Save andyperlitch/5935527 to your computer and use it in GitHub Desktop.
Save andyperlitch/5935527 to your computer and use it in GitHub Desktop.
Testing setup with Blanket.js coverage for Browserify
browserify test/test.bundle.entry.js > test.bundle.js
// Entry point for test bundle.
// All of these spec files get
// bundled into test.bundle.js
require('../path/to/spec1');
require('../path/to/spec2');
require('../path/to/spec3');
<html>
<head>
<title>Test Runner</title>
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" type="text/css" media="screen" charset="utf-8">
</head>
<body>
<div id="mocha"></div>
<script src="../js/vendor/jquery/dist/jquery.js"></script>
<script src="../node_modules/mocha/mocha.js" type="text/javascript" charset="utf-8"></script>
<script src="../node_modules/chai/chai.js" type="text/javascript" charset="utf-8"></script>
<script>
mocha.setup('bdd');
expect = chai.expect;
</script>
<script src="blanket.js" data-cover-flags="debug"></script>
<script src="mocha.adaptor.js"></script>
<script src="test.bundle.js" data-cover></script>
<script>
mocha.globals([ 'script*' ]).run();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment