function executeTests(tests, callback) { // context is `this` object in test functions // it can be used to track data between tests var context = {};
(async function executeRemainingTests(remainingTests) { if (!remainingTests.length) {
callback(); return;
}
var nextTest = remainingTests.shift(); var finishTest = executeRemainingTests.bind(null, remainingTests); var startTest = nextTest.call.bind(nextTest, context, finishTest);
try {
await startTest(); // if no callback was defined for test function, // we must manually invoke finish to continue if (nextTest.length === 0) {
finishTest();
}
} catch (e) {
ok(false, `Test threw exception: ${e}`);
finishTest();
}
})(tests);
}
// NotificationTest API return {
run(tests) {
SimpleTest.waitForExplicitFinish();
addLoadEvent(async function () {
executeTests(tests, function () {
SimpleTest.finish();
});
});
},
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.