Ho appena trovato qHint, un metodo per integrare il test jsHint in Qunit ... ma non funziona localmente (non intendo localhost) tranne in Firefox.Saltare un test in Qunit
così ho voluto aggiungere un "warning" o "avviso", NON è un fallimento del test, mostrando che il test è stato saltato:
// do unit test if not local or local and running Firefox
t = QUnit.isLocal;
if (!t || (t && /Firefox/.test(navigator.userAgent))) {
jsHintTest('JSHint core check', 'js/myplugin.js');
} else {
test('JSHint core check (skipped)', function(){
ok(true, 'check not done locally');
});
}
vorrei solo per renderlo più evidente che un test è stato saltato, è possibile?
Update: Grazie per Odi la risposta !, ma ho dovuto fare una leggera modifica per far funzionare il codice QUnit v1.11.0pre:
QUnit.testSkip = function(testName, callback) {
QUnit.test(testName + ' (SKIPPED)', function() {
if (typeof callback === "function") {
callback();
}
var li = document.getElementById(QUnit.config.current.id);
QUnit.done(function() {
li.style.background = '#FFFF99';
});
});
};
testSkip = QUnit.testSkip;
QUnit ha aggiunto un [metodo '' skip() '] (http://api.qunitjs.com/QUnit.skip/) nella v1.16! – Mottie