Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

feature: tools/testifier #28

Closed
Antonboom opened this issue Nov 3, 2023 · 1 comment
Closed

feature: tools/testifier #28

Antonboom opened this issue Nov 3, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@Antonboom
Copy link
Owner

The tool that rewrites std testing.T assertions with stretchr/testify.

Example

Before:

func TestEncryptAndDecryptData(t *testing.T) {
	key1, err := CreateRandBytes(kubeadmconstants.CertificateKeySize)
	if err != nil {
		t.Fatal(err)
	}

	key2, err := CreateRandBytes(kubeadmconstants.CertificateKeySize)
	if err != nil {
		t.Fatal(err)
	}
 	// ...
}

After:

func TestEncryptAndDecryptData(t *testing.T) {
	key1, err := CreateRandBytes(kubeadmconstants.CertificateKeySize)
 	require.NoError(t, err)

	key2, err := CreateRandBytes(kubeadmconstants.CertificateKeySize)
 	require.NoError(t, err)
  	// ...
}

P.S. Press 👍 if you think this idea make sense.

@Antonboom Antonboom added the enhancement New feature or request label Nov 3, 2023
@ccoVeille
Copy link
Contributor

Extracted from this comment from maintainer in a PR about adding something to CONTRIBUTING

#77 (comment)

Hi!

1. I meant a more common solution than just fatal replacer.

2. `testifier` proposed to be a separate tool and maybe in separate repo

So the idea in this issue is more than adding new rules.

It might be a separate linter that will detect if code is tests could be replaced by using testify (either if code is partially using testify or simply not using it)

@Antonboom Antonboom changed the title Feature request: tools/testifier feature: tools/testifier Jun 5, 2024
Repository owner locked and limited conversation to collaborators Jun 21, 2024
@Antonboom Antonboom converted this issue into discussion #148 Jun 21, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants