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

Commit 1137d12

Browse files
committed
fix(mocha): fix it.only so that it does not double-wrap
Closes #649
1 parent 7334e6c commit 1137d12

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/runner.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ Runner.prototype.runMocha_ = function(specs, done) {
119119
mocha = new Mocha(this.config_.mochaOpts),
120120
self = this;
121121

122-
123122
// Mocha doesn't set up the ui until the pre-require event, so
124123
// wait until then to load mocha-webdriver adapters as well.
125124
mocha.suite.on('pre-require', function() {
@@ -129,8 +128,13 @@ Runner.prototype.runMocha_ = function(specs, done) {
129128
global.before = mochaAdapters.before;
130129
global.beforeEach = mochaAdapters.beforeEach;
131130

131+
// The implementation of mocha's it.only uses global.it, so since that has
132+
// already been wrapped we must avoid wrapping it a second time.
133+
// See Mocha.prototype.loadFiles and bdd's context.it.only for more details.
134+
var originalOnly = global.it.only;
132135
global.it = mochaAdapters.it;
133-
global.it.only = global.iit = mochaAdapters.it.only;
136+
global.it.only = global.iit = originalOnly;
137+
134138
global.it.skip = global.xit = mochaAdapters.xit;
135139
});
136140

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"chai": "~1.8.1",
2727
"chai-as-promised": "~4.1.0",
2828
"jasmine-reporters": "~0.2.1",
29-
"mocha": "~1.16.0",
29+
"mocha": "~1.18.0",
3030
"cucumber": "~0.3.3",
3131
"express": "~3.3.4",
3232
"lodash": "~2.4.1",

0 commit comments

Comments
 (0)