Closed ghost closed 10 years ago
I used mocha in browser. I even can show you simple example ((previous issue)[https://github.com/visionmedia/should.js/issues/191] take a look on christopher example, it shows how to use mocha in browser with grunt and browserify). For test coverage i used blanket.
I do not think need to answer on SO, i almost always answer on issues in day or faster.
Hi @btd . Thanks for quick reply. I've been going mental trying to get Karma to run, wondering if you have any advice for me. I have been able to get Mocha/Should tests to run with Karma (many many hours of pain) and now have hit another wall trying to integrate my existing QUnit tests. I'm not new to unit testing but am apparently pretty green when it comes to JS unit testing. I've been getting by with QUnit for some time but have wanted to automate as well as streamline my tests, which led me to Should.js, which led me to Mocha. Which led me to Karma.
Part of the issue is that my whole app uses RequireJS modules, which I am discovering is a royal pain to integrate with basically all of the above.
Do you have any thoughts or suggestions at the highest level as to how I might proceed? In an ideal world I'd have multiple test frameworks included in a Karma setup -- centralized, watches for any changes, can run on browsers, etc. In the real world, is this too much to hope for? While I somewhat like the syntax of BDD and Mocha/Should looks like a good combo, I feel I'm killing a lot of time at this point and not sure its worth the effort. But then, QUnit tests are rather verbose and not that readable, so I'd love to get this working.
Any advice is appreciated. There do not seem to be great guidelines on best practices out there with all the available tools for testing JS.
Sorry, i could not suggest much about karma, just used if for quick look. I am not sure you are using any build tool, but when you are using any module system you 100% need to use one (either grunt or gulp - i am switching to second, but at all projects now use first). Also there is karma grunt plugin, which can help. I sometimes to see how people use something looking on yeoman generators ( i remember was one for grunt and karma ) - so you can try generate project, run and see what you can reuse.
Thanks for the tips :)
Should looks pretty nice, and for my case I'd like to write some tests in the browser -- all browsers I need to support on my current project support all of ES5. Is there any test runner I can use? Just looking for some sort of visual output, not yet needing any automation.
I'd ask on SO but looks like the name "should" was not chosen to be searchable :) shouldjs has 6 questions over 3 years.