Skip to content

feat: add offline test mode for locally saved questions #409

Description

@ericklucioh

I added an offline test mode to leetgo in my fork, ericklucioh/leetgo (https://github.com/ericklucioh/leetgo), so questions can be tested
later without depending on the LeetCode API at test time.

What changed:

  • leetgo pick now stores local offline metadata for the generated question.
  • The saved data includes:
    • slug
    • frontend id
    • language
    • output directory
    • generated filenames
    • question content
    • translated content
    • question metadata
  • A new offline test flow was added:
    • leetgo test -O
  • Offline testing works only with local artifacts already generated by pick.
  • The offline flow still supports -t to run a subset of cases.

Examples:

leetgo pick 1
leetgo test -O last
leetgo test -O last -t 1-3

Current behavior and limitations:

  • Offline state is stored per ProjectRoot(), so it is tied to the repository where pick was run.
  • Because of that, the offline cache is not automatically shared across different clones or forks.
  • Offline mode does not support system design questions yet.
  • If required metadata is missing, leetgo pick must be run again.
  • -O cannot be combined with --local, --both, --submit, or --force.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions