JSCover - JavaScript Code Coverage
Hi, I've developed JSCover (based on JSCoverage) and was wondering if anyone from JQuery is interested in assisting in integrating it with JQuery. I'm looking at this anyway (as I'm interested in improving the quality), but help from your side would be great. I'm running the 1.8.3 branch with Mongoose, but always get 4 failures. Running through JSCover results in a few more failures (I'd like help tracking down the cause of all failures), but I think the result are still useful. To run in proxy mode
testDone should get assert message
According to the documentation, the testDone() callback does not receive the assertion message. IE: assert.ok(false, "Here is important debugging information you need to fix this test"); By experimentation, I see that there's actually an additional field, "assertions" which contains the info I need. So the documentation for that callback could use an update.
Async Improvement to check if it's completed from external code
Hi, I'd like to propose a change to the QUnit async function that I found useful. Specifically testing if another async function has not completed this could be a cause for issues. Therefore this change proposes a way to check for this by attaching a state variable to the returning function: // Increment this Test's semaphore counter, then return a single-use function that // decrements that counter a maximum of once. async: function() { var test = this.test, popped = false; test.semaphore += 1;
Documentation of QUnit.load()
I try to build an run through various Qunit-tests in various pages generated by a CMS.. After a page with its unit-tests worked out, the browser should load via AJAX the next testpage with other Qunit-Tests. I choose that way of testing, because I can develop the tests in small portions for special situations. I missed the documentation of QUit.load(), because I need that function to restart the Unittest after loading a new Page with new tests. I used the following sequence to restart the QUnit-tests
Callback to run before all tests in a module
I have a need to run a setup/teardown callback to setup state once for all the tests within a module. I have something implemented that works like: module("My Module", { beforeAll: function(){ // will run once for each module in which it's defined before all tests }, afterAll: function(){ // will run once for each module in which it's defined after all tests have run } }); Would this be something we'd be interested in having in QUnit?
On the architecture of qunit-fixture
[Please ignore this idea and focus on the reply. It explains why we were seeing setup and teardown called out of order and why we were under the impression that qunit-fixture was designed poorly. Cheers!] (Preface: I'm a relative new-comer to QUnit. I apologize if the following aspects of qunit-fixture have been discussed ad nauseam. I searched on google, stackoverflow--and of course here--and found nothing similar.) qunit-fixture is obviously a key aspect of QUnit and it does its job of preventing pollution just
Organizing tests in groups
When you have lots of tests, there are situations when you want to run only a subset of tests, e.g. when TDD'ing, or when you are fixing something in a restricted part of your project. To help with organizing and running subsets of tests, I developed QUnit Test Groups. The idea of this addon is to provide a way to organize the tests files in an hierarchy, and automatically render an outline where clicking a node will run all tests from that node to the bottom in the hierarchy. Please take a look
Code coverage results
It would be a good idea to include a summary of code coverage within any files or script tags that have had tests run against them, that are reported with the test results summary. Tom
Mocking and Stubbing
Hi, I mean when writing tests in some time you will need some mocking and stubbing for tests. I searched for a mock and stub things for QUnit and can't found it, so, I developed one: http://github.com/bitzesty/qunit-mock It supports simple mocking (expect a number of calls in a function) and stubbing. It automatic removes all mocking and stubbing after current tests (to archive this I need to make some around functions on window.test and window.asyncTest methods), it supports mocking async. For future
Icon to run individual test
Currently, if I want to run a specific test I have to double-click on the title of the test. While this works, there have been a number of occasions where I double-click, but the test closes and then I end up opening one the wrong one. I small icon to click on would be much simpler and prevent this from happening. Essentially, what I tend to do is if I see a failure in one of my tests, I open the test to view the results, either fix or add some debugging to figure out what is going on, and then
Conditionally Skip Tests
In the project I'm working on, there is a bunch of code specifically to test IE. We want to be able to unit test this code and have those tests run on IE, but they would fail if run on other browsers. I wanted to get people's thoughts on how this could be better supported by QUnit. Right now I believe the only real option is to add an if statement within the test (or split the IE tests into a separate HTML file and just know to not run that particular file, but that doesn't work easily with continuous