-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
convert tests to mocha #849
Conversation
It's beautiful. 😂 |
@@ -0,0 +1,44 @@ | |||
var async = require('../lib/async'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a big fan of the suffixed file names. Why not just run tests on everything in mocha_test/*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats what happening at the moment anyway. Would you want this named forever.js
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, file name = function name?
On Fri, Jul 17, 2015 at 7:03 PM, Charlie Rudolph notifications@github.com
wrote:
In mocha_test/forever_test.js
#849 (comment):@@ -0,0 +1,44 @@
+var async = require('../lib/async');Thats what happening at the moment anyway. Would you want this named
forever.js?—
Reply to this email directly or view it on GitHub
https://github.com/caolan/async/pull/849/files#r34938385.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats what happening at the moment anyway
No, karma looks only for _test
You have to set this in travis.yml addons:
firefox: "39.0" |
This will make it difficult to support |
What is the requirement to support |
Can karma run nodeunit? |
Anyway, I say we merge this, and then start improving on it. 👍 |
Yes it does appear karma can run nodeunit. Unsure if it can mocha and nodeunit at the same time though |
Added karma-mocha-reporter so we get nice output when karma runs tests. |
I don't know I think its nice to be able run with |
Would require 2 karma config files |
Got karma with nodeunit running
Looks like a few bugs. We can add this in a separate PR if we want it |
Ok, we can start migrating this as we see fit. Also, karma makes node_modules huge... |
I'm having second thoughts on this. I'm not sure if mocha is the right choice for the testRunner. I would prefer a test runner that allows users to run tests in parallel. Currently the test suite takes about 10-20 seconds (unmeasured) to execute. It'd be sweet if we could use a test runner that allows us to run these tests at the same time. Mocha doesn't give us this mochajs/mocha#98; I think |
I don't see much benefit from running the tests in parallel. Each test fakes async operations with setTimeout with low to no delay. There are no long running async operations. |
Minimal delay (its about 20+ ms depending on the test) adds up across hundreds of tests. This is clearly illustrated as we are currently past a 21 second running time. A lot of this time is spent in the I/O event timer call stack, which could be minimized through parallelization The 5 mocha tests you've converted thus far take 200ms! |
1 of those is 174 ms spent making sure forever can avoid a stack overflow. |
Yes, and the majority of that time is spent waiting for recursive |
Ha, I tried making parallel mocha work a while back: mochajs/mocha#849 The problem is if you have tests running in parallel and an exception is thrown, the |
Par chance, have you looked into how |
At a quick glance, it looks like they use a multi-process test runner. |
Upon further review, I think https://github.com/sindresorhus/ava would be the best test runner for this project |
Ugh, always new tools. I'd be hesitant to switch to it, seeing as we're not even halfway through migrating to mocha. Mocha is also has really good adoption in the greater JS world, so it's one less thing for a new contributor to learn most of the time. |
Sure it's relatively new, however, that library aims to solve the main The nice thing about Ava is it uses tap api so if we run into issues we
|
Another thing, I just noticed Ava doesn't support browsers -- only jsdom. |
Yes, but it runs on the tape protocol which works in the browser |
@aearly @megawac
just a proof of concept where you can run mocha tests in node and in the browser.
Works right along side the nodeunit tests, so could be transitioned over one by one.