QUnitのコールバックを使用してそれを実現できます。これらは、テストの実行中にいくつかの異なるポイントで呼び出されます (たとえば、各テストの前、各モジュールの後など)。
これが私のテストスイートの例です:
QUnit.begin = function() {
console.log('####');
};
QUnit.testStart = function(test) {
var module = test.module ? test.module : '';
console.log('#' + module + " " + test.name + ": started.");
};
QUnit.testDone = function(test) {
var module = test.module ? test.module : '';
console.log('#' + module + " " + test.name + ": done.");
console.log('####');
};
これを というファイルに入れhelper.js
、テストの index.html ページに含めます。
次のような出力が生成されます。
####
#kort-Availability Includes: started.
#kort-Availability Includes: done.
####
#kort-UrlLib Constructor: started.
#kort-UrlLib Constructor: done.
####
#kort-UrlLib getCurrentUrl: started.
#kort-UrlLib getCurrentUrl: done.
####