Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Makes the ui pluggable alongside reporters #551

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
5 participants

See readme in tests, it's rather straightforward. Need it for scones (bit like mocha-cakes but is a UI)

This pull request passes (merged 826a49b into 5b43314).

@tj tj commented on the diff Aug 24, 2012

lib/mocha.js
};
+function tryLoadModule(name){
@tj

tj Aug 24, 2012

Contributor

this should be more like the reporter implementation:

Mocha.prototype.reporter = function(name){
  name = name || 'dot';
  this._reporter = require('./reporters/' + name);
  if (!this._reporter) throw new Error('invalid reporter "' + name + '"');
  return this;
};
@serialseb

serialseb Aug 25, 2012

I'm confused, is this reporter implementation in later versions of master as i have?

Is this still allowing for reporters loaded at a random location when passed (as reative or absolute path) at the command line or in mocha.opts, while still loading the existing ones? Also, I was under the impression that require threw on node, and the existing code had a mix of try/catch and checking for existence. Which one should it be? I'll update the pull request.

@tj tj commented on the diff Aug 24, 2012

lib/mocha.js
};
+function tryLoadModule(name){
+ try{
+ return require(name);
+ } catch(err) {
+ try{
+ return require(path.resolve(name))
+ } catch(err2) {
+ throw ('Could not load module \'' + name + '\'. See below for details.\r\n' + err + '\r\n' + err2);
@serialseb

serialseb Aug 25, 2012

I blame @robashton for not slapping me on the face for that one. :) Lesson learnt.

@tj tj commented on the diff Aug 24, 2012

test/acceptance/interfaces/custom/readme.md
@@ -0,0 +1,8 @@
+# Write tests with a custom API you can. Hmmm.
+
+Running the test, easy it can be when you use the force:
+mocha .\test\acceptance\interfaces\custom\example.js --ui test/acceptance/interfaces/custom/yoda.js
@tj

tj Aug 24, 2012

Contributor

we should set this up as a make target and remove this file

@serialseb

serialseb Aug 25, 2012

I'll do that monday. The readme is still read by github so I thought the comedy value was high enough to include. I'll remove it

More generally, are you happy for the principles of the pull request? I do think that in the longer term it would be useful to have a way to get the current mocha instance from any code currently running, as it'd remove the need for a UI for anything that is happy dealing with the suite api itself. Not sure if it is acceptable in js (globals are bad right?) but it'd remove the need for UIs alltogether.

Hey, I'm awaiting this to be merged as I'd quite like to use the framework that @serialseb has developed using this functionality

What work is outstanding to make this happen? Can I do it?

Work outstanding is actually replying to pull requests. Or move on. A year already, time flies innit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment