Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-3458

Replace internal/require and internal/assert with testify

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • 2.2.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Go Drivers

      Context

      The Go Driver copies functions from https://pkg.go.dev/github.com/stretchr/testify and puts them into internal/assert and internal/require for use in tests. Presumably, the purpose of this is to avoid taking a dependnecy on stretchr/testify. From the PR #1137

      This allows us to remove a number of dependencies and have a more consistent API for future testing.

      However, from the Go Documentation:

      [An indirect dependency] is a package transitively imported by a package or test in the main module, but whose path does not appear in any import declaration in the main module; or a module that appears in the module graph but does not provide any package directly imported by the main module.

      That is, dependencies that are used exclusively in tests are marked with the // indirect comment in the go.mod file, which indicates that these dependencies are not required for the module's consumers but are needed for testing or development purposes. Since stretchr/testify would be an indirect dependency unrelated to direct dependnecies, we can rely on the fact that it will be pruned from the final module graph for users of the Go Driver.

      Definition of done

      Remove internal/assert and internal/require in favor of github.com/stretchr/testify.

      Pitfalls

      NA

            Assignee:
            Unassigned Unassigned
            Reporter:
            preston.vasquez@mongodb.com Preston Vasquez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: