Skip to content
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

[prefer-spy-on] duplicate mockImplementation in autofix #1307

Closed
FloEdelmann opened this issue Dec 12, 2022 · 1 comment · Fixed by #1308
Closed

[prefer-spy-on] duplicate mockImplementation in autofix #1307

FloEdelmann opened this issue Dec 12, 2022 · 1 comment · Fixed by #1308

Comments

@FloEdelmann
Copy link
Contributor

Given the following code:

foo.bar = jest.fn().mockImplementation(baz => baz)

The jest/prefer-spy-on rule autofixes this to:

jest.spyOn(foo, 'bar').mockImplementation().mockImplementation(baz => baz)

The mockImplementation should rather be deduplicated. Expected autofix:

jest.spyOn(foo, 'bar').mockImplementation(baz => baz)
@FloEdelmann FloEdelmann changed the title [prefer-spy-on]: duplicate mockImplementation in autofix [prefer-spy-on] duplicate mockImplementation in autofix Dec 12, 2022
@github-actions
Copy link

🎉 This issue has been resolved in version 27.1.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

2 participants