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

refactor: use require for testing errors #1100

Merged
merged 1 commit into from
Apr 6, 2023
Merged

Conversation

pd93
Copy link
Member

@pd93 pd93 commented Mar 31, 2023

Uses github.com/stretchr/testify/require to test errors instead of github.com/stretchr/testify/assert. This applies to both NoError and Error functions.

This means that execution of the test will stop if we get an into an unexpected state and it will stop further cascading error assertions from obscuring the root cause.

The assert package is still used everywhere else as this means that we can see when multiple values are incorrect if the test is in a "good" state.

@pd93 pd93 linked an issue Mar 31, 2023 that may be closed by this pull request
Copy link
Member

@andreynering andreynering left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely an improvement.

There's a couple of conflicts, but once fixed feel free to merge.

@pd93 pd93 force-pushed the use-require-for-test-errors branch from ce3dc98 to 87393c2 Compare April 6, 2023 10:00
@pd93 pd93 marked this pull request as ready for review April 6, 2023 10:00
@pd93 pd93 merged commit 719f302 into master Apr 6, 2023
@pd93 pd93 deleted the use-require-for-test-errors branch April 6, 2023 10:18
@pd93 pd93 mentioned this pull request Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider migrating from stretchr/testify/assert to alecthomas/assert
2 participants