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

Dropping a bunch of OOTB modules for 0.8.0. #576

Merged
merged 6 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 1 addition & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Weaver-test

A test-framework built on [cats-effect](https://github.com/typelevel/cats-effect) and
[fs2](https://github.com/functional-streams-for-scala/fs2), with [zio](https://zio.dev) and [monix](https://monix.io) interop.
[fs2](https://github.com/functional-streams-for-scala/fs2)

## Installation

Expand All @@ -23,24 +23,8 @@ Refer yourself to the [releases](https://github.com/disneystreaming/weaver-test/
libraryDependencies += "com.disneystreaming" %% "weaver-cats" % "x.y.z" % Test
testFrameworks += new TestFramework("weaver.framework.CatsEffect")

// optionally (for ZIO usage)
libraryDependencies += "com.disneystreaming" %% "weaver-zio" % "x.y.z" % Test
testFrameworks += new TestFramework("weaver.framework.ZIO")

// optionally (for Monix usage)
libraryDependencies += "com.disneystreaming" %% "weaver-monix" % "x.y.z" % Test
testFrameworks += new TestFramework("weaver.framework.Monix")

// optionally (for Monix BIO usage)
libraryDependencies += "com.disneystreaming" %% "weaver-monix-bio" % "x.y.z" % Test
testFrameworks += new TestFramework("weaver.framework.MonixBIO")

// optionally (for Scalacheck usage)
libraryDependencies += "com.disneystreaming" %% "weaver-scalacheck" % "x.y.z" % Test

// optionally (for specs2 interop)
libraryDependencies += "com.disneystreaming" %% "weaver-specs2" % "x.y.z" % Test

```

## Motivation
Expand Down Expand Up @@ -132,20 +116,11 @@ object MySuite extends IOSuite {

Weaver also includes support for

- `ZIO`-based suites via the optional `weaver-zio` dependency
- `Monix`-based suites via the optional `weaver-monix` dependency
- `Monix BIO`-based suites via the optional `weaver-monix-bio` dependency

| Alias | Suite name | Provided by | Use case |
| ----------------- | ------------------------ | ------------------ | --------------------------------------------- |
| `SimpleIOSuite` | `SimpleMutableIOSuite` | `weaver-cats` | Each test is a standalone `IO` action |
| `IOSuite` | `MutableIOSuite` | `weaver-cats` | Each test needs access to a shared `Resource` |
| `SimpleZIOSuite` | `SimpleMutableZIOSuite` | `weaver-zio` | Each test is a standalone `ZIO` action |
| `ZIOSuite[R]` | `MutableZIOSuite[R]` | `weaver-zio` | Each test needs access to a shared `ZLayer` |
| `SimpleTaskSuite` | `SimpleMutableTaskSuite` | `weaver-monix` | Each test is a standalone `Task` action |
| `TaskSuite` | `MutableTaskSuite` | `weaver-monix` | Each test needs access to a shared `Resource` |
| `SimpleIOSuite` | `SimpleMutableIOSuite` | `weaver-monix-bio` | Each test is a standalone `Task` action |
| `IOSuite` | `MutableIOSuite` | `weaver-monix-bio` | Each test needs access to a shared `Resource` |

### Expectations (assertions)

Expand Down
55 changes: 6 additions & 49 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,14 @@ sonatypeCredentialHost := "s01.oss.sonatype.org"

val Version = new {
object CE3 {
val fs2 = "3.3.0"
val cats = "3.3.14"
val zioInterop = "3.2.9.1"
val fs2 = "3.3.0"
val cats = "3.3.14"
}

val expecty = "0.16.0"
val portableReflect = "1.1.2"
val junit = "4.13.2"
val scalajsStubs = "1.1.0"
val specs2 = "4.16.1"
val discipline = "1.5.1"
val catsLaws = "2.8.0"
val scalacheck = "1.16.0"
Expand All @@ -65,7 +63,6 @@ lazy val allModules = Seq(
core.projectRefs,
framework.projectRefs,
scalacheck.projectRefs,
specs2.projectRefs,
discipline.projectRefs,
intellijRunner.projectRefs,
effectCores,
Expand Down Expand Up @@ -124,15 +121,15 @@ val allEffectCoresFilter: ScopeFilter =
val allIntegrationsCoresFilter: ScopeFilter =
ScopeFilter(
inProjects(
(scalacheck.projectRefs ++ specs2.projectRefs ++ discipline.projectRefs): _*),
(scalacheck.projectRefs ++ discipline.projectRefs): _*),
inConfigurations(Compile)
)

lazy val docs = projectMatrix
.in(file("modules/docs"))
.jvmPlatform(Seq(WeaverPlugin.scala213))
.enablePlugins(DocusaurusPlugin, MdocPlugin)
.dependsOn(core, scalacheck, cats, zio, specs2, discipline)
.dependsOn(core, scalacheck, cats, discipline)
.settings(
moduleName := "docs",
watchSources += (ThisBuild / baseDirectory).value / "docs",
Expand Down Expand Up @@ -229,19 +226,6 @@ lazy val scalacheck = projectMatrix
"org.typelevel" %%% "cats-effect-testkit" % Version.CE3.cats % Test)
)

lazy val specs2 = projectMatrix
.in(file("modules/specs2"))
.sparse(withJS = true, withScala3 = false)
.dependsOn(core, cats % "test->compile")
.settings(
name := "specs2",
testFrameworks := Seq(new TestFramework("weaver.framework.CatsEffect")),
libraryDependencies ++= Seq(
"org.specs2" %%% "specs2-matcher" % Version.specs2
)
)
.settings(WeaverPlugin.simpleLayout)

lazy val discipline = projectMatrix
.in(file("modules/discipline"))
.sparse(withJS = true, withScala3 = true)
Expand All @@ -261,7 +245,7 @@ lazy val discipline = projectMatrix
// #################################################################################################

lazy val effectCores: Seq[ProjectReference] =
coreCats.projectRefs ++ coreZio.projectRefs
coreCats.projectRefs

lazy val coreCats = projectMatrix
.in(file("modules/core/cats"))
Expand All @@ -271,27 +255,11 @@ lazy val coreCats = projectMatrix
.settings(scalaJSMacroTask)
.settings(name := "cats-core")

lazy val coreZio = projectMatrix
.in(file("modules/core/zio"))
.sparse(withJS = true, withScala3 = false)
.dependsOn(core)
.settings(WeaverPlugin.simpleLayout)
.settings(
name := "zio-core",
libraryDependencies ++=
Seq(
"dev.zio" %%% "zio-interop-cats" % Version.CE3.zioInterop
)
)

// #################################################################################################
// Effect-specific frameworks
// #################################################################################################

lazy val effectFrameworks: Seq[ProjectReference] = Seq(
cats.projectRefs,
zio.projectRefs
).flatten
lazy val effectFrameworks: Seq[ProjectReference] = cats.projectRefs

lazy val cats = projectMatrix
.in(file("modules/framework/cats"))
Expand All @@ -303,17 +271,6 @@ lazy val cats = projectMatrix
testFrameworks := Seq(new TestFramework("weaver.framework.CatsEffect"))
)

lazy val zio = projectMatrix
.in(file("modules/framework/zio"))
.sparse(withJS = true, withScala3 = false)
.dependsOn(framework, coreZio, scalacheck % "test->compile")
.settings(WeaverPlugin.simpleLayout)
.settings(
name := "zio",
testFrameworks := Seq(new TestFramework("weaver.framework.ZIO")),
libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % Version.scalaJavaTime % Test
)

// #################################################################################################
// Intellij
// #################################################################################################
Expand Down
8 changes: 0 additions & 8 deletions docs/funsuite.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,3 @@ object CatsFunSuite extends weaver.FunSuite {
```scala mdoc:passthrough
println(weaver.docs.Output.runSuites(CatsFunSuite))
```

A `FunSuite` alias is provided in each of the frameworks supported by weaver:

```scala mdoc
object ZioBIOFunSuite extends weaver.ziocompat.FunSuite {
test("asserts") { expect(Some(5).contains(5)) }
}
```
7 changes: 1 addition & 6 deletions docs/global_resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ NB : the implementations have to be static objects.
```scala mdoc
import weaver._

// The same API / developer experience is offered with any of the following imports :
// import weaver.monixcompat._
// import weaver.monixbiocompat._
// import weaver.ziocompat._

import cats.effect.IO
import cats.effect.Resource

Expand Down Expand Up @@ -129,7 +124,7 @@ class MyOtherSuite(global: GlobalRead) extends IOSuite {

def sharedResource: Resource[IO, String] = sharedResourceOrFallback(global)

test("oops, forgot something here") { sharedString =>
test("oops, forgot something here") { sharedString =>
IO(expect(sharedString == "hello world!"))
}
}
Expand Down
5 changes: 1 addition & 4 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ id: installation
title: Installation
---

All of the artifacts below are available for both **JVM and Scala.js**.

Note, that artifacts that use Cats Effect 3 are published under a different version to those published for Cats Effect 2 (minor version bump), because they're binary incompatible.
The artifacts below are available for **Scala JVM, Scala.js, Scala-native**.

```scala mdoc:passthrough
import weaver.docs._
Expand All @@ -30,4 +28,3 @@ the effect-type library you've elected to use (or test against).
Refer yourself to the library specific pages to get the correct configuration.

- [cats](cats_effect_usage.md)
- [zio](zio_usage.md)
4 changes: 2 additions & 2 deletions docs/intellij.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ We (the maintainers) had tried to build an IntelliJ plugin. It worked but its ma

## Installation

Ensure the JUnit plugin is enabled in IntelliJ. Nothing else is needed (as long as weaver is declared correctly in your build).
Ensure the JUnit plugin is enabled in IntelliJ. Nothing else is needed (as long as weaver is declared correctly in your build).

## Usage

Expand Down Expand Up @@ -46,7 +46,7 @@ object MyIgnoreSuite extends SimpleIOSuite {

A `.only` extension method is provided on strings, and can be used when declaring tests. When at least one test is "tagged" as such in a suite, weaver will ignore all tests but the ones that have the "only" tag. Note: `.ignore` has precedence over `.only`.

```scala mdoc  
```scala mdoc
import weaver._
import cats.effect._

Expand Down
2 changes: 1 addition & 1 deletion docs/motivation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Motivation

## A test framework for integration tests

Weaver was built for integration/end-to-end tests. It aims at making tests faster and make issues easier to debug, by treating effect types (IO/Task/ZIO) as first-class citizens.
Weaver was built for integration/end-to-end tests. It aims at making tests faster and make issues easier to debug, by treating effect types as first-class citizens.

## History

Expand Down
23 changes: 23 additions & 0 deletions docs/other_effects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
id: other_effects

title: Other effects
---

Starting with version 0.8.0, Weaver does no longer offer out-of-the-box support for other effect types
Baccata marked this conversation as resolved.
Show resolved Hide resolved
than cats-effect.

We (maintainers) are happy to keep the core of weaver effect-agnostic, in an effort to allow for third party
to resurrect support for the effect types they use in repository they control.

You can read about the rationale for decision [here](https://github.com/disneystreaming/weaver-test/discussions/570). Feel free to ping us via a github discussion, if you seek to resurrect support for a given effect-type.

If you are looking for documentation of them maintenance branch of weaver that did support other effect types, you can find it [over there](https://disneystreaming.github.io/weaver-test/docs/0.6.15/installation).
Baccata marked this conversation as resolved.
Show resolved Hide resolved

We will try to fix critical bugs on the 0.6/0.7 series, as they get found.

To summarise :

* `0.8.x` and further -> CE3 only, active development,
* `0.7.x` -> CE3 + ZIO 1 support (maintenance mode, fixing critical bugs that not have workarounds)
* `0.6.x` -> CE2 + Monix/MonixBIO/ZIO 1 support (maintenance mode, fixing critical bugs that do not have workarounds)
75 changes: 2 additions & 73 deletions docs/specs2.md
Original file line number Diff line number Diff line change
@@ -1,77 +1,6 @@
---
id: specs2
title: specs2 integration
title: specs2 (discontinued)
---

Weaver comes with [specs2](http://specs2.org/) matchers interop, allowing for matcher style testing.

## Installation

You'll need to install an additional dependency in order to use specs2 matchers with Weaver.

### SBT
```scala
libraryDependencies += "com.disneystreaming" %% "weaver-specs2" % "@VERSION@" % Test
```

### Mill
```scala
object test extends Tests {
def ivyDeps = Agg(
ivy"com.disneystreaming::weaver-specs2:@VERSION@"
)
}
```

## Usage

Add the `weaver.specs2compat.IOMatchers` mixin to use specs2 matchers within your test suite.

```scala mdoc
import weaver.SimpleIOSuite

import weaver.specs2compat.IOMatchers

object MatchersSpec extends SimpleIOSuite with IOMatchers {
pureTest("pureTest { 1 must beEqualTo(1) }") {
1 must beEqualTo(1)
}

pureTest("pureTest { 1 must be_==(1) }") {
1 must be_==(1)
}

pureTest("pureTest { 1 mustEqual 1 }") {
1 mustEqual 1
}

pureTest("pureTest { 1 === 1 }") {
1 === 1
}

pureTest("pureTest { 1 must beEqualTo(1) }") {
1 must beEqualTo(1)
}

pureTest("pureTest { 1 must be_==(1) }") {
1 must be_==(1)
}

pureTest("pureTest { 1 mustEqual 1 }") {
1 mustEqual 1
}

pureTest("pureTest { 1 === 1 }") {
1 === 1
}

pureTest("failure example") {
1 must beEqualTo(2)
}
}

```

```scala mdoc:passthrough
println(weaver.docs.Output.runSuites(MatchersSpec))
```
The specs2-matchers integration has been dropped in weaver 0.8.0. If you want to test CE code with specs2 UX, please consider using [cats-effect-testing](https://github.com/typelevel/cats-effect-testing).
Loading