scalatest / scalatestplus-scalacheck

ScalaTest + ScalaCheck provides integration support between ScalaTest and ScalaCheck.
Apache License 2.0
57 stars 24 forks source link

Imports and various versions #36

Open vreuter opened 4 years ago

vreuter commented 4 years ago

For a long time I was having trouble w/ 3.0.x --> 3.1.x migration, but everywhere I'm using scalatest and scalatestplus been running pretty smoothly for a while now. I had an old repo that was still on 3.0.8, though, and today I upped to 3.1.2, and I hit an issue I used to have with one of the imports:

[error] <test-file-pathh>.scala:5:12: object scalatestplus is not a member of package org
[error] import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
[error]            ^
[error]  <test-file-path>.scala:12:58: not found: type ScalaCheckDrivenPropertyChecks
[error] class TestPhrases extends AnyFunSuite with Matchers with ScalaCheckDrivenPropertyChecks {

What was strange was that I'd matched imports in a test file and dependency declarations in the build file to files from a project where 3.1.2 working great:

build.sbt:

libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.14.3" % "test"
libraryDependencies += "org.scalactic" %% "scalactic" % "3.1.2" % "test"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.2" % "test"

Imports in test file:

import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.matchers.should.Matchers
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks

Yet, in one project the tests could run great through sbt and in the other I ran up against the import error. Turns out, in the project where things were working, I was also using discipline:

libraryDependencies += "org.typelevel" %% "discipline-scalatest" % "1.0.1"

Adding that dependency to the problematic project got things working. Is it known why that would be?

I guess not a big deal, but I'm definitely curious if anyone can point me toward the reason. Thanks in advance!

jan0sch commented 2 years ago

I just stumbled upon the same issue but not triggered by scalatestplus update but by updating another library (monocle). The same error message and it was solved also by manually including discipline-scalatest into the dependencies.