Skip to content

kasra-r77/user-event-update-codemod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

User Event Update Plugin

This is a codemod plugin that helps migrate from @testing-library/user-event v13 to v14.

Installation

To use this plugin, you need to install codemod/cli:

$ npm install @codemod/cli

Usage

$ npx codemod --plugin ./user-event-update-plugin path/to/your/file/or/directory

This will update all instances of userEvent to async userEvent per their docs here. This is being tested for Jest and it also turn the second argument of it blocks into async functions.

Example

// before
it("should do something", () => {
  userEvent.click(screen.getByRole("button"));
});

// after
it("should do something", async () => {
  await userEvent.click(screen.getByRole("button"));
});

Contributing

If you find any issues or have suggestions for improvement, please feel free to open an issue or submit a pull request.

About

a codemod plugin that helps migrating from `@testing-library/user-event` v13 to v14.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published