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

fix(mocha): Wrap it.only with the selenium adapter #3512

Merged
merged 1 commit into from
Sep 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions lib/frameworks/mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,8 @@ exports.run = function(runner, specs) {
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 = originalOnly;

global.it.only = global.iit = mochaAdapters.iit;
global.it.skip = global.xit = mochaAdapters.xit;
} catch (err) {
deferred.reject(err);
Expand Down
12 changes: 12 additions & 0 deletions spec/mocha/lib_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,16 @@ describe('protractor library', function() {
browser.get('index.html');
expect(browser.getTitle()).to.eventually.equal('My AngularJS App');
});

describe('with async tests', function() {
var finished = false;

it('should wait for async operations to finish', function() {
browser.get('index.html').then(() => { finished = true });
});

after('verify mocha waited', function() {
if(!finished) { throw new Error('Mocha did not wait for async!'); }
});
});
});