☕️ Classic, reliable, trusted test framework for Node.js and the browser
Mocha.ui() now tries to import ui module if name is not found in mocha.interfaces
Andrey Popp31b5d9e170fc
diff --git a/lib/mocha.js b/lib/mocha.jsindex 62e2ecbc..5d3f3ba3 100644--- a/lib/mocha.js+++ b/lib/mocha.js@@ -135,6 +135,7 @@ Mocha.prototype.reporter = function(reporter){Mocha.prototype.ui = function(name){name = name || 'bdd';this._ui = exports.interfaces[name];+ if (!this._ui) try { this._ui = require(name); } catch (err) {};if (!this._ui) throw new Error('invalid interface "' + name + '"');this._ui = this._ui(this.suite);return this;