UNPKG

@power-doctest/markdown

Version:
58 lines (57 loc) 1.4 kB
/** * CodeBlockの手前に該当するHTMLコメントはdoctestの制御コードとして扱える * * @example * 以下のは実行されないのでOKになる * * <!-- doctest:disable --> * ```js * 1; // => 2 * ``` * * @example * 次はdoctestの結果のError名を指定できる * * <!-- doctest: ReferenceError --> * ```js * NO_DEFINE++; * ``` * * @type {String} */ export declare class DocTestController { private comments; private _expectedErrorName; /** * @param {string[]} comments */ constructor(comments: string[]); /** * Return state of @power-doctest/types */ get state(): "none" | "disabled" | "enabled"; /** * @returns {string|undefined} */ get expectedErrorName(): string | undefined; /** * @returns {boolean} */ get hasExpectedError(): boolean; get doctestMetadata(): {} | undefined; get doctestOptions(): {} | undefined; /** * Return true, if the `error` is expected error name * If not defined expected error, return true. * @param {Error} [error] * @returns {boolean} */ isExpectedError(error: Error): boolean; /** * Return expected Error name if expected is defined. * @returns {string[]} * @returns {string|undefined} * @private */ _getExpectedErrorName(comments: string[]): string | undefined; }