@averagehelper/corde
Version:
A simple library for Discord bot tests. (Republished fork to demonstrate a bugfix)
31 lines (30 loc) • 893 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.beforeStart = void 0;
const testCollector_1 = require("../common/testCollector");
/**
* Declare a bunch of code that will be executed before tests begins.
*
* More than one declaration of this code results in a list
* of functions to run.
*
* They will be executed following a sequence of files
* reads and the positions of each `afterAll` call.
*
* @example
* // The main function of this is for start a bot if you haven't started it yet
*
* const bot = new Discord.Client();
* beforeStart(async () => {
* await bot.login(config.botTestToken);
* });
*
* @param fn code that will be executed **before** tests start
* @since 1.0
*/
function beforeStart(fn) {
if (fn) {
testCollector_1.testCollector.beforeStartFunctions.enqueue(fn);
}
}
exports.beforeStart = beforeStart;