<commit_before>/**
 * Callable API
 * describe("description", callback)
 */

import {callStack} from "./callstack";
import {Describe} from "../queue/Describe";
import {QueueManager} from "../queue/QueueManager";

export function describe(label: string, callback: () => void) {
    let _describe: Describe;

    if (arguments.length !== 2 || typeof (arguments[0])
        !== "string" || typeof (arguments[1]) !== "function") {
        throw new TypeError("describe called with invalid parameters");
    }

    // a Description object
    _describe = new Describe(callStack.uniqueId.toString(), label, callback,
        callStack.length && callStack.getTopOfStack() || null,
        callStack.length && callStack.getTopOfStack().excluded || false);

    // push Describe onto the queue only if it is a top level Describe
    // if (callStack.length === 0) {
    //     QueueManager.queue.push(_describe);
    // } else {
    //     callStack.getTopOfStack().items.push(_describe);
    // }

    // push Describe onto the queue
    QueueManager.queue.push(_describe);

    // push Describe onto the callstack
    callStack.pushDescribe(_describe);

    // call callback to register the beforeEach, afterEach, it and describe calls
    try {
        _describe.callback();
    } catch (error) {
        console.log(error);
        alert("Error caught when calling Describe callback. See console for more information");
        throw new Error("Terminating test!");
    }<commit_msg>Now accumulating total Describes.<commit_after>/**
 * Callable API
 * describe("description", callback)
 */

import {callStack} from "./callstack";
import {Describe} from "../queue/Describe";
import {QueueManager} from "../queue/QueueManager";

export function describe(label: string, callback: () => void) {
    let _describe: Describe;

    if (arguments.length !== 2 || typeof (arguments[0])
        !== "string" || typeof (arguments[1]) !== "function") {
        throw new TypeError("describe called with invalid parameters");
    }

    // a Description object
    _describe = new Describe(callStack.uniqueId.toString(), label, callback,
        callStack.length && callStack.getTopOfStack() || null,
        callStack.length && callStack.getTopOfStack().excluded || false);

    // push Describe onto the queue only if it is a top level Describe
    // if (callStack.length === 0) {
    //     QueueManager.queue.push(_describe);
    // } else {
    //     callStack.getTopOfStack().items.push(_describe);
    // }

    // push Describe onto the queue
    QueueManager.queue.push(_describe);

    // increment totDescribes count
    QueueManager.totDescribes++;

    // push Describe onto the callstack
    callStack.pushDescribe(_describe);

    // call callback to register the beforeEach, afterEach, it and describe calls
    try {
        _describe.callback();
    } catch (error) {
        console.log(error);
        alert("Error caught when calling Describe callback. See console for more information");
        throw new Error("Terminating test!");
    }
{'fraction_non_alphanumeric': 0.13099146421536442, 'fraction_numerical': 0.0026263952724885093, 'mean_word_length': 3.0518617021276597, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2066506', 'n_tokens_mistral': 828, 'n_tokens_neox': 809, 'n_words': 243}