In early versions of QUnit, it was possible to create logging functions that would be invoked as QUnit processed tests and modules by assigning to specific properties of the QUnit object. This became problematic when multiple logging functions would overwrite each other, and QUnit quickly adopted a callback consumer approach.
This rule will detect assignments to QUnit.log
and other logging callbacks
and recommend that the corresponding functions be invoked instead.
The full list of QUnit logging callbacks are as follows:
QUnit.begin()
Qunit.done()
QUnit.log()
QUnit.moduleDone()
QUnit.moduleStart()
QUnit.testDone()
QUnit.testStart()
The following patterns are considered warnings:
QUnit.begin = function () { };
QUnit.done = function () { };
QUnit.log = function () { };
QUnit.moduleDone = function () { };
QUnit.moduleStart = function () { };
QUnit.testDone = function () { };
QUnit.testStart = function () { };
The following patterns are not warnings:
QUnit.begin(function () { });
QUnit.done(function () { });
QUnit.log(function () { });
QUnit.moduleDone(function () { });
QUnit.moduleStart(function () { });
QUnit.testDone(function () { });
QUnit.testStart(function () { });
This rule should probably be enabled, unless working in a legacy codebase that will not be upgrading to QUnit 2.0 and which has no concerns of overwriting others' logging callbacks.