Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Added Hook

Tj Holowaychuk27dceada39b4
diff --git a/lib/hook.js b/lib/hook.js
new file mode 100644
index 00000000..0dba20c3
--- /dev/null
+++ b/lib/hook.js
@@ -0,0 +1,30 @@
+
+/**
+ * Module dependencies.
+ */
+
+var Runnable = require('./runnable');
+
+/**
+ * Expose `Hook`.
+ */
+
+module.exports = Hook;
+
+/**
+ * Initialize a new `Hook` with the given `title` and callback `fn`.
+ *
+ * @param {String} title
+ * @param {Function} fn
+ * @api private
+ */
+
+function Hook(title, fn) {
+ Runnable.call(this, title, fn);
+}
+
+/**
+ * Inherit from `Runnable.prototype`.
+ */
+
+Hook.prototype.__proto__ = Runnable.prototype;
diff --git a/lib/mocha.js b/lib/mocha.js
index 578e96d2..bc37165f 100644
--- a/lib/mocha.js
+++ b/lib/mocha.js
@@ -16,4 +16,5 @@ exports.reporters = require('./reporters');
exports.Runnable = require('./runnable');
exports.Runner = require('./runner');
exports.Suite = require('./suite');
+exports.Hook = require('./hook');
exports.Test = require('./test');
\ No newline at end of file
diff --git a/test.js b/test.js
index 48e6a484..3d8afa0c 100644
--- a/test.js
+++ b/test.js
@@ -1,16 +1,25 @@
describe('something', function(){
- // beforeEach(function(done){
- // done()
- // done()
- // done()
- // })
+ beforeEach(function(done){
+ done()
+ done()
+ done()
+ })
- it('should work', function(done){
- done();
- done();
- done();
- done();
- done();
+ it('should work', function(){
+
})
+
+ // it('should work', function(done){
+ // // done();
+ // done()
+ // done()
+ // done()
+ // done()
+ // setTimeout(done, 4000);
+ // })
+ //
+ // it('should work again', function(done){
+ // setTimeout(done, 5000);
+ // })
})
\ No newline at end of file