Skip to content

armgit / mocha

Public Imported from GitHub
0

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

1.18.1

Travis Jeffery577199e98dde
diff --git a/History.md b/History.md
index 86bdecf6..27bc02ed 100644
--- a/History.md
+++ b/History.md
@@ -1,3 +1,8 @@
+1.18.1 / 2014-03-18
+==================
+
+ * fix: named before/after hooks in bdd, tdd, qunit interfaces (#1161)
+
1.18.0 / 2014-03-13
==================
diff --git a/bower.json b/bower.json
index 608a8650..0050bbcb 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "mocha",
- "version": "1.18.0",
+ "version": "1.18.1",
"main": "mocha.js",
"ignore": [
"bin",
diff --git a/component.json b/component.json
index eafb7df1..3f213007 100644
--- a/component.json
+++ b/component.json
@@ -1,6 +1,6 @@
{
"name": "mocha",
- "version": "1.18.0",
+ "version": "1.18.1",
"repo": "visionmedia/mocha",
"description": "simple, flexible, fun test framework",
"keywords": [
diff --git a/mocha.js b/mocha.js
index bdc803f4..6c3d51ce 100644
--- a/mocha.js
+++ b/mocha.js
@@ -915,32 +915,32 @@ module.exports = function(suite){
* 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);
};
/**
@@ -1137,32 +1137,32 @@ module.exports = function(suite){
* 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);
};
/**
@@ -1263,32 +1263,32 @@ module.exports = function(suite){
* Execute before each test case.
*/
- context.setup = function(fn){
- suites[0].beforeEach(fn);
+ context.setup = function(name, fn){
+ suites[0].beforeEach(name, fn);
};
/**
* Execute after each test case.
*/
- context.teardown = function(fn){
- suites[0].afterEach(fn);
+ context.teardown = function(name, fn){
+ suites[0].afterEach(name, fn);
};
/**
* Execute before the suite.
*/
- context.suiteSetup = function(fn){
- suites[0].beforeAll(fn);
+ context.suiteSetup = function(name, fn){
+ suites[0].beforeAll(name, fn);
};
/**
* Execute after the suite.
*/
- context.suiteTeardown = function(fn){
- suites[0].afterAll(fn);
+ context.suiteTeardown = function(name, fn){
+ suites[0].afterAll(name, fn);
};
/**
@@ -1720,8 +1720,9 @@ Mocha.prototype.run = function(fn){
if (this.files.length) this.loadFiles();
var suite = this.suite;
var options = this.options;
+ options.files = this.files;
var runner = new exports.Runner(suite);
- var reporter = new this._reporter(runner);
+ var reporter = new this._reporter(runner, options);
runner.ignoreLeaks = false !== options.ignoreLeaks;
runner.asyncOnly = options.asyncOnly;
if (options.grep) runner.grep(options.grep, options.invert);
@@ -4325,10 +4326,10 @@ Runnable.prototype.run = function(fn){
// sync or promise-returning
try {
- if (!this.pending) {
- callFn(this.fn);
- } else {
+ if (this.pending) {
done();
+ } else {
+ callFn(this.fn);
}
} catch (err) {
done(err);
@@ -4338,12 +4339,7 @@ Runnable.prototype.run = function(fn){
var result = fn.call(ctx);
if (result && typeof result.then === 'function') {
self.resetTimeout();
- result.then(
- function(){
- done();
- },
- done
- );
+ result.then(function(){ done() }, done);
} else {
done();
}
diff --git a/package.json b/package.json
index e0100a81..921d67db 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "mocha",
- "version": "1.18.0",
+ "version": "1.18.1",
"description": "simple, flexible, fun test framework",
"keywords": [
"mocha",