Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not detect doctests on typescript class methods #88

Open
wizzardx opened this issue Aug 30, 2024 · 1 comment
Open

Does not detect doctests on typescript class methods #88

wizzardx opened this issue Aug 30, 2024 · 1 comment

Comments

@wizzardx
Copy link

In my src/functions.ts, I have a class that starts like this:

/**
 * Represents a basic calculator with arithmetic operations.
 */
export class Calculator {
  private accumulator: Big | "Infinity" | null = null;
  private nextOperator: Operator | null = null;

  // State relating to the current input number:
  private currentInputNumber: Big | null = null;
  private decimalButtonPressed: boolean = false;
  nextDecimalPlace: number | null = null;

  /**
   * Get the current value of the accumulator.
   *
   * @returns {Big | "Infinity" | null} The current accumulator value.
   * @example
   * ```ts @import.meta.vitest
   * const calc = new Calculator()
   * expect(calc.getAccumulator()).toBeNull()
   * xxx295
   * ```
   */
  public getAccumulator(): Big | "Infinity" | null {
    return this.accumulator;
  }

I'm expecting doc-vitest to fail because "xxx295" is not defined. From what I can tell so far, doc-vitest only runs against the doctests within top-level modules typescript function declarations.

@ssssota
Copy link
Owner

ssssota commented Oct 29, 2024

This problem may be fixed. Please try new version!
https://github.com/ssssota/doc-vitest/releases/tag/vite-plugin-doctest%401.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants