vendor/node_modules/mocha/lib/interfaces/bdd.js in stylus-source-0.42.2 vs vendor/node_modules/mocha/lib/interfaces/bdd.js in stylus-source-0.49.3
- old
+ new
@@ -1,13 +1,13 @@
-
/**
* Module dependencies.
*/
var Suite = require('../suite')
, Test = require('../test')
- , utils = require('../utils');
+ , utils = require('../utils')
+ , escapeRe = require('escape-string-regexp');
/**
* BDD-style interface:
*
* describe('Array', function(){
@@ -31,46 +31,47 @@
/**
* Execute before running tests.
*/
- context.before = function(fn){
- suites[0].beforeAll(fn);
+ context.before = function(name, fn){
+ suites[0].beforeAll(name, fn);
};
/**
* Execute after running tests.
*/
- context.after = function(fn){
- suites[0].afterAll(fn);
+ context.after = function(name, fn){
+ suites[0].afterAll(name, fn);
};
/**
* Execute before each test case.
*/
- context.beforeEach = function(fn){
- suites[0].beforeEach(fn);
+ context.beforeEach = function(name, fn){
+ suites[0].beforeEach(name, fn);
};
/**
* Execute after each test case.
*/
- context.afterEach = function(fn){
- suites[0].afterEach(fn);
+ context.afterEach = function(name, fn){
+ suites[0].afterEach(name, fn);
};
/**
* Describe a "suite" with the given `title`
* and callback `fn` containing nested suites
* and/or tests.
*/
context.describe = context.context = function(title, fn){
var suite = Suite.create(suites[0], title);
+ suite.file = file;
suites.unshift(suite);
fn.call(suite);
suites.shift();
return suite;
};
@@ -105,22 +106,23 @@
* acting as a thunk.
*/
context.it = context.specify = function(title, fn){
var suite = suites[0];
- if (suite.pending) var fn = null;
+ if (suite.pending) fn = null;
var test = new Test(title, fn);
+ test.file = file;
suite.addTest(test);
return test;
};
/**
* Exclusive test-case.
*/
context.it.only = function(title, fn){
var test = context.it(title, fn);
- var reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$';
+ var reString = '^' + escapeRe(test.fullTitle()) + '$';
mocha.grep(new RegExp(reString));
return test;
};
/**