Lines Matching refs:suite
944 var Suite = require('../suite')
966 module.exports = function(suite){
967 var suites = [suite];
969 suite.on('pre-require', function(context, file, mocha){
977 context.run = mocha.options.delay && common.runWithSuite(suite);
979 * Describe a "suite" with the given `title`
985 var suite = Suite.create(suites[0], title);
986 suite.file = file;
987 suites.unshift(suite);
988 fn.call(suite);
990 return suite;
1000 var suite = Suite.create(suites[0], title);
1001 suite.pending = true;
1002 suites.unshift(suite);
1003 fn.call(suite);
1008 * Exclusive suite.
1012 var suite = context.describe(title, fn);
1013 mocha.grep(suite.fullTitle());
1014 return suite;
1024 var suite = suites[0];
1025 if (suite.pending) fn = null;
1028 suite.addTest(test);
1071 * root suite execution. Returns a function which runs the root suite.
1073 runWithSuite: function runWithSuite(suite) {
1075 suite.run();
1125 var Suite = require('../suite')
1145 module.exports = function(suite){
1146 var suites = [suite];
1148 suite.on('require', visit);
1151 var suite;
1174 suite = Suite.create(suites[0], key);
1175 suites.unshift(suite);
1198 var Suite = require('../suite')
1206 * suite('Array');
1220 * suite('String');
1228 module.exports = function(suite){
1229 var suites = [suite];
1231 suite.on('pre-require', function(context, file, mocha){
1239 context.run = mocha.options.delay && common.runWithSuite(suite);
1241 * Describe a "suite" with the given `title`.
1244 context.suite = function(title){
1246 var suite = Suite.create(suites[0], title);
1247 suite.file = file;
1248 suites.unshift(suite);
1249 return suite;
1256 context.suite.only = function(title, fn){
1257 var suite = context.suite(title, fn);
1258 mocha.grep(suite.fullTitle());
1296 var Suite = require('../suite')
1304 * suite('Array', function(){
1305 * suite('#indexOf()', function(){
1326 module.exports = function(suite){
1327 var suites = [suite];
1329 suite.on('pre-require', function(context, file, mocha){
1337 context.run = mocha.options.delay && common.runWithSuite(suite);
1339 * Describe a "suite" with the given `title`
1344 context.suite = function(title, fn){
1345 var suite = Suite.create(suites[0], title);
1346 suite.file = file;
1347 suites.unshift(suite);
1348 fn.call(suite);
1350 return suite;
1354 * Pending suite.
1356 context.suite.skip = function(title, fn) {
1357 var suite = Suite.create(suites[0], title);
1358 suite.pending = true;
1359 suites.unshift(suite);
1360 fn.call(suite);
1368 context.suite.only = function(title, fn){
1369 var suite = context.suite(title, fn);
1370 mocha.grep(suite.fullTitle());
1380 var suite = suites[0];
1381 if (suite.pending) fn = null;
1384 suite
1445 exports.Suite = require('./suite');
1486 this.suite = new exports.Suite('', new exports.Context);
1495 this.suite.on('pre-require', function (context) {
1500 exports.describe = context.describe || context.suite;
1505 exports.suite = context.suite || context.describe;
1521 this.suite.bail(bail);
1575 this._ui = this._ui(this.suite);
1587 var suite = this.suite;
1591 suite.emit('pre-require', global, file, self);
1592 suite.emit('require', require(file), file, self);
1593 suite.emit('post-require', global, file, self);
1750 this.suite.timeout(timeout);
1763 this.suite.slow(slow);
1776 this.suite.enableTimeouts(arguments.length && enabled !== undefined
1805 * Delay root suite execution.
1823 var suite = this.suite;
1826 var runner = new exports.Runner(suite, options.delay);
2041 , 'suite': 0
2218 runner.on('suite', function(suite){
2220 suite.root || stats.suites++;
2479 runner.on('suite', function(suite){
2480 if (suite.root) return;
2482 console.log('%s<section class="suite">', indent());
2484 console.log('%s<h1>%s</h1>', indent(), utils.escape(suite.title));
2488 runner.on('suite end', function(suite){
2489 if (suite.root) return;
2734 runner.on('suite', function(suite){
2735 if (suite.root) return;
2737 // suite
2738 var url = self.suiteURL(suite);
2739 var el = fragment('<li class="suite"><h1><a href="%s">%s</a></h1></li>', url, escape(suite.title));
2747 runner.on('suite end', function(suite){
2748 if (suite.root) return;
2832 * Provide suite URL
2834 * @param {Object} [suite]
2836 HTML.prototype.suiteURL = function(suite){
2837 return makeUrl(suite.fullTitle());
2883 var suites = document.getElementsByClassName('suite');
2895 var els = document.getElementsByClassName('suite hidden');
2897 els[i].className = els[i].className.replace('suite hidden', 'suite');
3484 function mapTOC(suite, obj) {
3486 key = SUITE_PREFIX + suite.title;
3487 obj = obj[key] = obj[key] || { suite: suite };
3488 suite.suites.forEach(function(suite){
3489 mapTOC(suite, obj);
3499 if ('suite' == key) continue;
3502 link += '(#' + utils.slug(obj[key].suite.fullTitle()) + ')\n';
3510 function generateTOC(suite) {
3511 var obj = mapTOC(suite, {});
3515 generateTOC(runner.suite);
3517 runner.on('suite', function(suite){
3519 var slug = utils.slug(suite.fullTitle());
3521 buf += title(suite.title) + '\n';
3524 runner.on('suite end', function(suite){
3538 process.stdout.write(generateTOC(runner.suite));
3996 runner.on('suite', function(suite){
3998 console.log(color('suite', '%s%s'), indent(), suite.title);
4001 runner.on('suite end', function(suite){
4080 var total = runner.grepTotal(runner.suite);
4435 if ('parent' == key) return '#<Suite>';
4607 * Initialize a `Runner` for the given `suite`.
4613 * - `suite` (suite) test suite execution started
4614 * - `suite end` (suite) all tests (and sub-suites) have finished
4623 * @param {Suite} suite Root suite
4624 * @param {boolean} [delay] Whether or not to delay execution of root suite
4629 function Runner(suite, delay) {
4634 this.suite = suite;
4635 this.total = suite.total();
4676 this.total = this.grepTotal(this.suite);
4682 * given suite.
4684 * @param {Suite} suite
4689 Runner.prototype.grepTotal = function(suite) {
4693 suite.eachTest(function(test){
4794 * - Failed `before` hook skips all tests in a suite and subsuites,
4797 * suite and jumps to corresponding `after each` hook,
4802 * suite and subsuites, but executes other `after each`
4812 if (this.suite.bail()) {
4826 var suite = this.suite
4827 , hooks = suite['_' + name]
4850 suite.pending = true;
4881 , orig = this.suite;
4883 function next(suite) {
4884 self.suite = suite;
4886 if (!suite) {
4887 self.suite = orig;
4893 var errSuite = self.suite;
4894 self.suite = orig;
4914 var suites = [this.suite].concat(this.parents()).reverse();
4927 var suites = [this.suite].concat(this.parents());
4940 var suite = this.suite
4942 while (suite = suite.parent) suites.push(suite);
4970 * Run tests in the given `suite` and invoke
4973 * @param {Suite} suite
4978 Runner.prototype.runTests = function(suite, fn){
4980 , tests = suite.tests.slice()
4986 var orig = self.suite;
4990 self.suite = after ? errSuite.parent : errSuite;
4992 if (self.suite) {
4995 self.suite = orig;
4998 // report error suite
5003 self.suite = orig;
5010 if (self.failures && suite._bail) return fn();
5038 if (suite.pending) {
5077 * Run the given `suite` and invoke the
5080 * @param {Suite} suite
5085 Runner.prototype.runSuite = function(suite, fn){
5086 var total = this.grepTotal(suite)
5090 debug('run suite %s', suite.fullTitle());
5094 this.emit('suite', this.suite = suite);
5098 // current suite failed on a hook from errSuite
5099 if (errSuite == suite) {
5100 // if errSuite is current suite
5101 // continue to the next sibling suite
5104 // errSuite is among the parents of current suite
5112 var curr = suite.suites[i++];
5118 self.suite = suite;
5120 self.emit('suite end', suite);
5127 self.runTests(suite, next);
5170 * Run the root suite and invoke `fn(failures)`
5180 rootSuite = this.suite;
5293 require.register("suite.js", function(module, exports, require){
5299 , debug = require('browser/debug')('mocha:suite')
5305 * Expose `Suite`.
5308 exports = module.exports = Suite;
5311 * Create a new `Suite` with the given `title`
5312 * and parent `Suite`. When a suite with the
5313 * same title is already present, that suite
5317 * @param {Suite} parent
5319 * @return {Suite}
5324 var suite = new Suite(title, parent.ctx);
5325 suite.parent = parent;
5326 if (parent.pending) suite.pending = true;
5327 title = suite.fullTitle();
5328 parent.addSuite(suite);
5329 return suite;
5333 * Initialize a new `Suite` with the given
5341 function Suite(title, parentContext) {
5367 Suite.prototype = new F;
5368 Suite.prototype.constructor = Suite;
5372 * Return a clone of this `Suite`.
5374 * @return {Suite}
5378 Suite.prototype.clone = function(){
5379 var suite = new Suite(this.title);
5381 suite.ctx = this.ctx;
5382 suite.timeout(this.timeout());
5383 suite.enableTimeouts(this.enableTimeouts());
5384 suite.slow(this.slow());
5385 suite.bail(this.bail());
5386 return suite;
5393 * @return {Suite|Number} for chaining
5397 Suite.prototype.timeout = function(ms){
5410 * @return {Suite|Boolean} self or enabled
5414 Suite.prototype.enableTimeouts = function(enabled){
5425 * @return {Suite|Number} for chaining
5429 Suite.prototype.slow = function(ms){
5441 * @return {Suite|Number} for chaining
5445 Suite.prototype.bail = function(bail){
5456 * @return {Suite} for chaining
5460 Suite.prototype.beforeAll = function(title, fn){
5483 * @return {Suite} for chaining
5487 Suite.prototype.afterAll = function(title, fn){
5510 * @return {Suite} for chaining
5514 Suite.prototype.beforeEach = function(title, fn){
5537 * @return {Suite} for chaining
5541 Suite.prototype.afterEach = function(title, fn){
5561 * Add a test `suite`.
5563 * @param {Suite} suite
5564 * @return {Suite} for chaining
5568 Suite.prototype.addSuite = function(suite){
5569 suite.parent = this;
5570 suite.timeout(this.timeout());
5571 suite.enableTimeouts(this.enableTimeouts());
5572 suite.slow(this.slow());
5573 suite.bail(this.bail());
5574 this.suites.push(suite);
5575 this.emit('suite', suite);
5580 * Add a `test` to this suite.
5583 * @return {Suite} for chaining
5587 Suite.prototype.addTest = function(test){
5606 Suite.prototype.fullTitle = function(){
5621 Suite.prototype.total = function(){
5622 return utils.reduce(this.suites, function(sum, suite){
5623 return sum + suite.total();
5628 * Iterates through each suite recursively to find
5633 * @return {Suite}
5637 Suite.prototype.eachTest = function(fn){
5639 utils.forEach(this.suites, function(suite){
5640 suite.eachTest(fn);
5646 * This will run the root suite if we happen to be running in delayed mode.
5648 Suite.prototype.run = function run() {
5654 }); // module: suite.js
6464 mocha.suite.removeAllListeners('pre-require');
6511 this.suite.emit('pre-require', global, null, this);