Skip to content

armgit / mocha

Public Imported from GitHub
0

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

{pre,post}-require events for bdd/tdd interfaces

Tj Holowaychuk41bc979f17b3
diff --git a/bin/mocha b/bin/mocha
index bc1b68bc..b6eeaf48 100755
--- a/bin/mocha
+++ b/bin/mocha
@@ -79,9 +79,9 @@ if (!files.length) {
var pending = files.length;
files.forEach(function(file){
file = join(cwd, file);
- // suite.emit('file', global, file);
+ suite.emit('pre-require', global, file);
suite.emit('require', require(file), file);
- // suite.emit('file end', global, file);
+ suite.emit('post-require', global, file);
--pending || run(suite);
});
diff --git a/lib/interfaces/bdd.js b/lib/interfaces/bdd.js
index 169fec40..ac825085 100644
--- a/lib/interfaces/bdd.js
+++ b/lib/interfaces/bdd.js
@@ -26,7 +26,7 @@ var Suite = require('../suite')
module.exports = function(suite){
var suites = [suite];
- suite.on('file', function(context, file){
+ suite.on('pre-require', function(context, file){
/**
* Describe a "suite" with the given `title`
diff --git a/lib/interfaces/tdd.js b/lib/interfaces/tdd.js
index cbbd6bea..1e05a814 100644
--- a/lib/interfaces/tdd.js
+++ b/lib/interfaces/tdd.js
@@ -26,7 +26,7 @@ var Suite = require('../suite')
module.exports = function(suite){
var suites = [suite];
- suite.on('file', function(context, file){
+ suite.on('pre-require', function(context, file){
/**
* Describe a "suite" with the given `title`