Lines Matching full:hook
883 require.register("hook.js", function(module, exports, require){
891 * Expose `Hook`.
894 module.exports = Hook;
897 * Initialize a new `Hook` with the given `title` and callback `fn`.
904 function Hook(title, fn) {
906 this.type = 'hook';
915 Hook.prototype = new F;
916 Hook.prototype.constructor = Hook;
927 Hook.prototype.error = function(err){
937 }); // module: hook.js
1446 exports.Hook = require('./hook');
2753 if ('hook' == test.type) runner.emit('test end', test);
4617 * - `hook` (hook) hook execution started
4618 * - `hook end` (hook) hook complete
4638 this.on('hook end', function(hook){ self.checkGlobals(hook); });
4790 * Fail the given `hook` with `err`.
4792 * Hook failures work in the following pattern:
4794 * - Failed `before` hook skips all tests in a suite and subsuites,
4795 * but jumps to corresponding `after` hook
4796 * - Failed `before each` hook skips remaining tests in a
4797 * suite and jumps to corresponding `after each` hook,
4799 * - Failed `after` hook does not alter
4801 * - Failed `after each` hook skips remaining tests in a
4805 * @param {Hook} hook
4810 Runner.prototype.failHook = function(hook, err){
4811 this.fail(hook, err);
4818 * Run hook `name` callbacks and then invoke `fn()`.
4825 Runner.prototype.hook = function(name, fn){
4832 var hook = hooks[i];
4833 if (!hook) return fn();
4834 self.currentRunnable = hook;
4836 hook.ctx.currentTest = self.test;
4838 self.emit('hook', hook);
4840 hook.on('error', function(err){
4841 self.failHook(hook, err);
4844 hook.run(function(err){
4845 hook.removeAllListeners('error');
4846 var testError = hook.error();
4852 self.failHook(hook, err);
4854 // stop executing hooks, notify callee of hook err
4858 self.emit('hook end', hook);
4859 delete hook.ctx.currentTest;
4870 * Run hook `name` for the given array of `suites`
4891 self.hook(name, function(err){
4985 // before/after Each hook for errSuite failed:
4988 // for failed 'after each' hook start from errSuite parent,
5034 // execute test and hook(s)
5098 // current suite failed on a hook from errSuite
5119 self.hook('afterAll', function(){
5125 this.hook('beforeAll', function(err){
5302 , Hook = require('./hook');
5466 title = '"before all" hook' + (title ? ': ' + title : '');
5468 var hook = new Hook(title, fn);
5469 hook.parent = this;
5470 hook.timeout(this.timeout());
5471 hook.enableTimeouts(this.enableTimeouts());
5472 hook.slow(this.slow());
5473 hook.ctx = this.ctx;
5474 this._beforeAll.push(hook);
5475 this.emit('beforeAll', hook);
5493 title = '"after all" hook' + (title ? ': ' + title : '');
5495 var hook = new Hook(title, fn);
5496 hook.parent = this;
5497 hook.timeout(this.timeout());
5498 hook.enableTimeouts(this.enableTimeouts());
5499 hook.slow(this.slow());
5500 hook.ctx = this.ctx;
5501 this._afterAll.push(hook);
5502 this.emit('afterAll', hook);
5520 title = '"before each" hook' + (title ? ': ' + title : '');
5522 var hook = new Hook(title, fn);
5523 hook.parent = this;
5524 hook.timeout(this.timeout());
5525 hook.enableTimeouts(this.enableTimeouts());
5526 hook.slow(this.slow());
5527 hook.ctx = this.ctx;
5528 this._beforeEach.push(hook);
5529 this.emit('beforeEach', hook);
5547 title = '"after each" hook' + (title ? ': ' + title : '');
5549 var hook = new Hook(title, fn);
5550 hook.parent = this;
5551 hook.timeout(this.timeout());
5552 hook.enableTimeouts(this.enableTimeouts());
5553 hook.slow(this.slow());
5554 hook.ctx = this.ctx;
5555 this._afterEach.push(hook);
5556 this.emit('afterEach', hook);