From 66397345c9902bf6bbb5bd7fd52f4764973d23df Mon Sep 17 00:00:00 2001 From: Flaise Date: Thu, 15 Oct 2015 17:48:35 -0500 Subject: [PATCH] Support for mocha's 'qunit' interface --- lib/frameworks/mocha.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/frameworks/mocha.js b/lib/frameworks/mocha.js index 1f55004f905..7fd0d7c203c 100644 --- a/lib/frameworks/mocha.js +++ b/lib/frameworks/mocha.js @@ -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'] }; /** @@ -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'; } @@ -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)); });