Manual:JavaScript unit testing/QUnit guidelines

QUnit comparisons
If at all possible use comparing functions such as,   etc. instead of. In most unit testing because it is more useful to have both the expected value and resulting value available to the debugger. When using  it forces one to do the contrary and make comparison inline (since   only takes one value). In case of a failure,  only reports "Passed" or "Failed", whereas   (having both values), can output useful debug information. This is especially important when working with test reports generated externally (eg. through TestSwarm) in which case the test report is all you have.

In cases where it exact value is too variable or doesn't matter, all it matters is that it is not falsy, then  use is fine:

But even then it can sometimes be more useful to do a type check. Suppose a variable is declared early and populated later, then you'll want to know more and a type check would reveal the type of value it contains it it's not what you expected. Using since JavaScript's built-in   is flawed.

Test elements
The  element can be used to add extra elements to manipulate, and will be automatically reset after each test (see ). The element is styled with position:absolute; top:-10000px; left:-10000; with these, it won't be obstructing the result, without affecting code the relies on the affected elements to be visible (instead of display:none).