Introducing Multiple Test Cases for Codemod Studio
Codemod Studio is where developers can create codemods with ease. It’s as simple as providing two code snippets—one representing the code before the transformation and the second representing the expected output. With these snippets, any user can utilize our AI service - codemodAI, which will infer the transformation function from the provided code.
But what if a user wants to create a more complex codemod that can process different types of inputs? As we strive to build the best developer experience, this was a question we needed to address.
After a challenging journey to rebuild the studio's core, we are ready to present new functionality: users can now add as many snippet pairs as needed. This can significantly improve the accuracy of the generated codemod.
Using multiple test cases
To add multiple test cases, you can simply:
- Click on the add test case button
- Insert the before/after snippet pairs
- Run Codemod AI
By doing so, Codemod AI will now use all of the test cases provided to generate your codemod.
TipIn the AST and Debugger tabs, a user will always see information about the code of the selected pair. Also, all test cases will be included when sharing a link to your codemod.
Get started
Now, equipped with broader knowledge, we can use codemodAI to prepare more complex codemods. Try the improved Codemod Studio now
Start migrating in seconds
Save days of manual work by running automation recipes to automate framework upgrades, right from your CLI, IDE or web app.