-
Notifications
You must be signed in to change notification settings - Fork 106
Merge work done in grunt-simple-mocha to this plugin #17
Conversation
Can you provide an example of the problems you had? Is the purpose to have both server and client side tests in a single task? It seems like you could do that by creating an alias/registertask. |
Both of these plugins register the task "mocha", and hence cannot be used simultaneously: https://github.com/kmiyashiro/grunt-mocha/blob/master/tasks/mocha.js#L142 Conceptually, grunt-simple-mocha seems cleaner, since it's 'just mocha', versus grunt-mocha fires up a browser and a bunch of .html pages. Since grunt is used to develop not only browser-based solutions, it would be logical that choosing mocha as the test runner would not automatically mean switching to browser-based testing. |
Hello, I'm the author of simple-mocha. One of my main reasons for publishing simple-mocha is that PhantomJS shouldn't be a dependency for people who want to run server-side tests. I feel like the right solution is for one of us to rename the task. I'd be happy to change it to |
@yaymukund Yeah, I think these tasks are for fundamentally different goals (client vs server tests), it just so happens mocha can be used for both without modification. I'd hate for either of us to change the task name since people will probably wonder why their task broke, but I'm more hesitant to change grunt-mocha's task name ever since yeoman added it as a dependency and there are now thousands of installations. |
Yes, I see this issue having more to do with grunt. One example grunt could do is have some sort of namespacing for npm tasks. Other option could maybe is to have grunt-mocha act as some sort of "base" mocha integration, which could be extended by further plugins - but this would break builds relying on the current functionality, as they would require one more plugin ("grunt-mocha-phantom?"). |
The more I think about it, the more I like the idea of just making |
Hi - Just to confirm that the forked version of simple-mocha with its grunt task renamed to So, a readme of this project can be updated regarding the naming conflict, as Mukund has renamed its task, so things now can work together. Cheers |
Cool, updated. I still like the idea of detecting whether there are html files in the files list and the trying to run |
If I put the |
@yaymukund helpers are going to be removed in grunt 0.4, instead you can just use normal node modules to import functions. Maybe you can wrap your main code in a normal node module and then it can easily be imported by any node module. |
👍 @kmiyashiro Can we get this landed? |
I'd have to review it since this was for grunt 0.3 and the config has changed, but there were also questions about whether it makes sense to combine frontend and backend tests in the same task. |
It's not so much about frontend vs backend tests; rather it's plain Mocha vs Mocha+PhantomJS. We write most client-side tests using Zombie.js and the simplemocha task. When that's not sufficient, we use this task. Looking for html files is okay, but I prefer to have a PhantomJS option for each target. |
I agree. Would be nice not to have to task for this. I have multiple modules that work both in the browser and in Node.js and currently I'm required to use two tasks to test it. |
Note: it could also be worth to look at grunt-mocha-test (compared to grunt-simple-mocha) for node.js testing as it is fully featured with many tests (less 'simple' :) |
I can't help but wonder what demons lie down that path. |
👍 |
I'm opening this pull request to propose merging work done in grunt-simple-mocha into this plugin. The patches I've created incorporate the functionality to this plugin in the following manner:
This pull request was inspired by having to deal with the two plugins sharing task names (see some of the forks of the grunt-simple-mocha plugin). I'm also attempting to contact the author of grunt-simple-mocha to have him collaborate on this plugin instead on the node.js testing part.