Skip to content

feat: Add testing framework to codmeod CLI #1536

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

Merged
merged 1 commit into from
Jun 13, 2025

Conversation

mohebifar
Copy link
Member

📚 Description

This PR revamps the testing framework for the jssg CLI command by introducing a modular architecture for test execution, configuration, and fixtures. It also introduces several new dependencies required to support these features and removes the now-obsolete Dockerfile.build.

Highlights:
  • New CLI test command: Implements a new test.rs file to support test execution for codemods, including features like filtering, snapshot updating, concurrency, and error reporting.

  • Modular test framework: Introduces a new testing module with dedicated submodules:

    • config.rs: Manages test options and reporter settings.
    • fixtures.rs: Handles test discovery, inputs/outputs, and fixture validation.
    • runner.rs: Orchestrates test runs and manages results.
  • Dependency additions:

    • For CLI testing: libtest-mimic, similar, notify, regex, walkdir, tempfile, num_cpus, thiserror, and more.
    • Added ast-grep-language and updated related crates in Cargo.toml with simplified version declarations.
  • Build simplification: Removes Dockerfile.build previously used for musl/OpenSSL builds, signaling a move away from Docker-based static linking.

These changes improve test ergonomics and make it easier to develop and run codemod tests across environments.

🔗 Linked Issue

🧪 Test Plan

  • Ran the new jssg test command on existing codemods with success.
  • Verified fixture discovery, parallel execution, and reporter output formats.
  • Ensured no regressions in unrelated CLI functionality.

📄 Documentation to Update

  • CLI usage docs to include new test command and configuration options.
  • Internal developer guide to reflect new testing module layout and patterns.

Copy link

vercel bot commented Jun 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
codemod ⬜️ Ignored (Inspect) Visit Preview Jun 13, 2025 4:47am

Copy link

pkg-pr-new bot commented Jun 13, 2025

Open in StackBlitz

npm i https://pkg.pr.new/codemod@1536

commit: b04a97f

@mohebifar mohebifar force-pushed the feat/codemod-testing-framework branch 3 times, most recently from 4c97ec3 to 4ebcbc2 Compare June 13, 2025 04:46
@mohebifar mohebifar force-pushed the feat/codemod-testing-framework branch from 4ebcbc2 to b04a97f Compare June 13, 2025 04:47
@mohebifar mohebifar merged commit 6167b15 into main Jun 13, 2025
15 checks passed
@mohebifar mohebifar deleted the feat/codemod-testing-framework branch June 13, 2025 05:00
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

Successfully merging this pull request may close these issues.

1 participant