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

Commit 8ca9833

Browse files
authored
fix(mocha): Wrap it.only with the selenium adapter. (#3512)
Fixes #3045. Since mocha 2.4.1, we should be wrapping global.it.only.
1 parent f23d027 commit 8ca9833

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

lib/frameworks/mocha.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,8 @@ exports.run = function(runner, specs) {
2727
global.before = mochaAdapters.before;
2828
global.beforeEach = mochaAdapters.beforeEach;
2929

30-
// The implementation of mocha's it.only uses global.it, so since that has
31-
// already been wrapped we must avoid wrapping it a second time.
32-
// See Mocha.prototype.loadFiles and bdd's context.it.only for more details.
33-
var originalOnly = global.it.only;
3430
global.it = mochaAdapters.it;
35-
global.it.only = global.iit = originalOnly;
36-
31+
global.it.only = global.iit = mochaAdapters.iit;
3732
global.it.skip = global.xit = mochaAdapters.xit;
3833
} catch (err) {
3934
deferred.reject(err);

spec/mocha/lib_spec.js

+12
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,16 @@ describe('protractor library', function() {
3434
browser.get('index.html');
3535
expect(browser.getTitle()).to.eventually.equal('My AngularJS App');
3636
});
37+
38+
describe('with async tests', function() {
39+
var finished = false;
40+
41+
it('should wait for async operations to finish', function() {
42+
browser.get('index.html').then(() => { finished = true });
43+
});
44+
45+
after('verify mocha waited', function() {
46+
if(!finished) { throw new Error('Mocha did not wait for async!'); }
47+
});
48+
});
3749
});

0 commit comments

Comments
 (0)