scalatestplus-play と ScalaTest を併用すると弊害がでる

scalatestplus-playscalatest は一緒に入れていいものだと勝手に思ってた。ScalaTestをPlay用に拡張するプラグインだと思ってた。けど、scalatestplus-play は ScalaTestを内包しているのでscalatest-playのみを入れればよかったようだ。むしろ、scalatest-play内のScalaTestと別に入れたScalaTestが競合するので分かりにくいエラーが起こる。

私の場合、PlaySpec にミックスインされているWordSpecの解決が、素のScalaTestの方を参照していたため、想定した挙動にならず、サンプル通りに実装しても動かないなどの事象に遭遇した。

PlayFrameworkのドキュメント Testing your application with ScalaTest を確認すると、build.sbtに関する記述は下記のみだ。

ibraryDependencies ++= Seq(   
  "org.scalatestplus.play" %% "scalatestplus-play" % "x.x.x" % Test
)

ScalaTestとscalatest-plusとのversion間の関係はGithubを見にいけばいい。

https://github.com/playframework/scalatestplus-play

次からは気をつけよう。。