feat: Add testing framework to codmeod CLI #1536
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📚 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-obsoleteDockerfile.build
.Highlights:
New CLI
test
command: Implements a newtest.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:
libtest-mimic
,similar
,notify
,regex
,walkdir
,tempfile
,num_cpus
,thiserror
, and more.ast-grep-language
and updated related crates inCargo.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
jssg test
command on existing codemods with success.📄 Documentation to Update
test
command and configuration options.