Skip to content

Instantly share code, notes, and snippets.

@KylePDavis
Last active October 12, 2015 19:18
Show Gist options
  • Save KylePDavis/4074607 to your computer and use it in GitHub Desktop.
Save KylePDavis/4074607 to your computer and use it in GitHub Desktop.
Self-hosted Mocha Test Case Template
"use strict";
// Mocha one-liner to make these tests self-hosted
if (!module.parent) return require.cache[__filename] = 0, (new(require("mocha"))()).addFile(__filename).ui("exports").run(process.exit);
// requires
var assert = require("assert"),
MyClass = require("../../lib/MyClass");
// tests
exports.MyClass = {
"#constructor": {
"should not throw Error": function(){
assert.doesNotThrow(function(){
new MyClass()
});
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment