Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
fix(mocha): fix it.only so that it does not double-wrap
Browse files Browse the repository at this point in the history
Closes #649
  • Loading branch information
juliemr committed Apr 21, 2014
1 parent 7334e6c commit 1137d12
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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;
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 1137d12

Please sign in to comment.