diff --git a/lib/runner.js b/lib/runner.js index d7800bd9a..76c6fddac 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -119,7 +119,6 @@ Runner.prototype.runMocha_ = function(specs, done) { mocha = new Mocha(this.config_.mochaOpts), self = this; - // Mocha doesn't set up the ui until the pre-require event, so // wait until then to load mocha-webdriver adapters as well. mocha.suite.on('pre-require', function() { @@ -129,8 +128,13 @@ Runner.prototype.runMocha_ = function(specs, done) { global.before = mochaAdapters.before; global.beforeEach = mochaAdapters.beforeEach; + // The implementation of mocha's it.only uses global.it, so since that has + // already been wrapped we must avoid wrapping it a second time. + // See Mocha.prototype.loadFiles and bdd's context.it.only for more details. + var originalOnly = global.it.only; global.it = mochaAdapters.it; - global.it.only = global.iit = mochaAdapters.it.only; + global.it.only = global.iit = originalOnly; + global.it.skip = global.xit = mochaAdapters.xit; }); diff --git a/package.json b/package.json index a2f368fd6..1474e692d 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "chai": "~1.8.1", "chai-as-promised": "~4.1.0", "jasmine-reporters": "~0.2.1", - "mocha": "~1.16.0", + "mocha": "~1.18.0", "cucumber": "~0.3.3", "express": "~3.3.4", "lodash": "~2.4.1",