/* this source code form is subject to the terms of the mozilla public * license, v. 2.0. if a copy of the mpl was not distributed with this
* file, you can obtain one at http://mozilla.org/mpl/2.0/. */
const { url } = script.source; const filename = url.substr(url.lastIndexOf("/") + 1); const line = testFileContent[lineNumber - 1]; // Grey out the beginning of the line, before frame's column, // and display an arrow before displaying the rest of the line. const code = "\x1b[2m" +
line.substr(0, columnNumber - 1) + "\x1b[0m" + "\u21A6 " +
line.substr(columnNumber - 1);
exports.start = function (testGlobal, testUrl, pause) { const tracerOptions = {
global: testGlobal, // Ensure tracing each execution within functions (and not only function calls)
traceSteps: true, // Only trace the running test and nothing else
filterFrameSourceUrl: testUrl,
};
testFileContent = readURI(testUrl).split("\n"); // Only pause on each step if the passed value is a number, // otherwise we are only going to print each executed line in the test script. if (!isNaN(pause)) { // Delay each step by an amount of milliseconds
tracerOptions.pauseOnStep = Number(pause);
logStep(`Tracing all test script steps with ${pause}ms pause`);
logStep(
`/!\\ Be conscious about each pause releasing the event loop and breaking run-to-completion.`
);
} else {
logStep(`Tracing all test script steps`);
}
logStep(
`'\u21A6 ' symbol highlights what precise instruction is being called`
);
JSTracer.startTracing(tracerOptions);
JSTracer.addTracingListener(tracingListener);
};
exports.stop = function () {
JSTracer.stopTracing();
JSTracer.removeTracingListener(tracingListener);
};
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 ist noch experimentell.