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

Added Mocha support #229

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
4 participants
Member

Krinkle commented Sep 19, 2012

Looks good. We'll have to test it once to confirm, but looking good.

Contributor

s-a commented Sep 19, 2012

Nice to read this.
Well, I' m still not shure what is the difference between fail and error in submit function.
https://github.com/s-a/testswarm/blob/334ea0450c09558f8f44476519e31cbd27470b7b/js/inject.js#L458

+1

Member

Krinkle commented Nov 1, 2012

failures are assertions (part of "total") that failed (e.g. A assert.equal(.., ..) where actual != expected).

errors are structural or global problems (uncaught exceptions, missing dependencies, whatever you can catch). If the framework of choice doesn't have such mechanism in place, just set it to 0.

@ghost ghost assigned Krinkle Nov 1, 2012

@Krinkle Krinkle commented on the diff Nov 2, 2012

js/inject.js
+ error: this.failures
+ });
+ });
+ _runner.on('start', window.TestSwarm.heartbeat);
+ _runner.on('suite', window.TestSwarm.heartbeat);
+ _runner.on('test end', window.TestSwarm.heartbeat);
+ _runner.on('pass', window.TestSwarm.heartbeat);
+ _runner.on('fail', window.TestSwarm.heartbeat);
+ return _runner;
+ };
+ window.TestSwarm.serialize = function () {
+ var _el = document.getElementsByTagName('pre');
+ // show source code
+ for (var i=0;i<_el.length;i++) _el[i].style.display = 'inline-block';
+ return trimSerialize();
+ };
@Krinkle

Krinkle Nov 2, 2012

Member

A few points for next time:

  • There was trailing space on almost every single line.
  • Don't use underscores, they are meaningless in javascript and only confuse the scope. Either way whether or not they are bad, the jQuery code conventions have decided on not allowing dangling _ in variable names (use node-jshint to automatically run the code against the rules in .jshintrc)
  • Accessing the length property of a HTMLCollection in a loop can be pretty expensive and can actually cause an infinite loop. The result from getElementsByTagName is not an array but a live HTMLCollection.
  • Inconsistent whitespace usage (presence/absence of the space after the functionoperator).

@Krinkle Krinkle closed this Nov 2, 2012

Member

Krinkle commented Nov 2, 2012

I had to fix it up differently to make it work reliable with the different modes and interfaces Mocha has. It still fails in Opera and IE but thats due to bugs in Mocha. I submitted pull requests to fix those bugs in Mocha:

patrickkettner added a commit to patrickkettner/testswarm that referenced this pull request Nov 5, 2012

Contributor

j commented Feb 6, 2013

👍 need this.... asap! 😑

Member

Krinkle commented Feb 7, 2013

As you can see on this page, the issue is closed because Mocha support has been implemented already (5 months ago) 😑

Are you showing expression of liking this (you're welcome!) or unaware of it being already done?

Contributor

j commented Feb 7, 2013

Haha, oops! My bad. I tried looking for the commit and couldn't find it since this PR was closed via commit.

Contributor

j commented Feb 7, 2013

I opened #261 to help confused people like me! We'll be running this in our CI with BrowserStack, and at first glance of the supported frameworks README, I nearly cried. This will help us Mocha folks! :)

Perhaps when we get everything on this, I'll help out with some features.

Thanks and cheers!

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