@academyjs/rover
Version:
Rover allows you to learn programming interactively.
72 lines • 1.55 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Initialize a new `Context`.
*
* @private
*/
class Context {
/**
* Set or get the context `Runnable` to `runnable`.
*
* @private
* @param {Runnable} runnable
* @return {Context} context
*/
runnable(runnable) {
if (!arguments.length) {
return this._runnable;
}
this.test = this._runnable = runnable;
return this;
}
/**
* Set or get test timeout `ms`.
*
* @private
* @param {number} ms
* @return {Context} self
*/
timeout(ms) {
if (!arguments.length) {
return this.runnable().timeout();
}
this.runnable().timeout(ms);
return this;
}
/**
* Set or get test slowness threshold `ms`.
*
* @private
* @param {number} ms
* @return {Context} self
*/
slow(ms) {
if (!arguments.length) {
return this.runnable().slow();
}
this.runnable().slow(ms);
return this;
}
/**
* Mark a test as skipped.
*
* @private
* @throws Pending
*/
skip() {
this.runnable().skip();
}
/**
* Set or get a number of allowed retries on failed tests
*/
retries(n) {
if (!arguments.length) {
return this.runnable().retries();
}
this.runnable().retries(n);
return this;
}
}
exports.default = Context;
//# sourceMappingURL=context.js.map