Skip to content

Commit

Permalink
Merge pull request #833 from Flaise/master
Browse files Browse the repository at this point in the history
Support for mocha's 'qunit' interface
  • Loading branch information
christian-bromann committed Oct 28, 2015
2 parents d1f5354 + 6639734 commit 46f0120
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/frameworks/mocha.js
Expand Up @@ -5,7 +5,8 @@ var q = require('q'),
hasES6Support = require('../helpers/detectHarmony'),
interfaces = {
bdd: ['before', 'beforeEach', 'it', 'after', 'afterEach'],
tdd: ['suiteSetup', 'setup', 'test', 'suiteTeardown', 'teardown']
tdd: ['suiteSetup', 'setup', 'test', 'suiteTeardown', 'teardown'],
qunit: ['before', 'beforeEach', 'test', 'after', 'afterEach']
};

/**
Expand All @@ -18,7 +19,7 @@ module.exports.run = function(config, specs, capabilities) {
requires = config.mochaOpts.require,
runner;

if(typeof config.mochaOpts.ui !== 'string' || !config.mochaOpts.ui.match(/(bdd|tdd)/i)) {
if(typeof config.mochaOpts.ui !== 'string') {
config.mochaOpts.ui = 'bdd';
}

Expand Down Expand Up @@ -46,7 +47,7 @@ module.exports.run = function(config, specs, capabilities) {
/**
* enable generators if supported
*/
if(hasES6Support) {
if(hasES6Support && interfaces[config.mochaOpts.ui]) {
mocha.suite.on('pre-require', function() {
interfaces[config.mochaOpts.ui].forEach(runInGenerator.bind(null, config.mochaOpts.ui));
});
Expand Down

0 comments on commit 46f0120

Please sign in to comment.