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

Migrate tests over to 'shared' so they run on Scala.js #804

Closed
16 of 17 tasks
jdegoes opened this issue Apr 27, 2019 · 10 comments
Closed
16 of 17 tasks

Migrate tests over to 'shared' so they run on Scala.js #804

jdegoes opened this issue Apr 27, 2019 · 10 comments
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@jdegoes
Copy link
Member

jdegoes commented Apr 27, 2019

A bunch of test suites right now run only on the JVM. As many as possible should be migrated over to shared so they run in Scala.js configuration.

The tests are currently located in core/jvm/src/test/scala/scalaz/zio and could be moved (one by one, PR by PR) to core/shared/src/test/scala/scalaz/zio.

  • ArbitraryCause.scala
  • ExitSpec.scala
  • FiberLocalSpec.scala
  • FiberSpec.scala
  • FunctionIOSpec.scala
  • GenIO.scala
  • IOSpec.scala
  • IOSyntaxSpec.scala
  • PlatformSpec.scala
  • PromiseSpec.scala
  • QueueSpec.scala
  • RefMSpec.scala
  • RefSpec.scala
  • RetrySpec.scala
  • stm/STMSpec.scala
  • duration/DurationSpec.scala
  • duration/DurationSyntaxSpec.scala

Some of these may reveal bugs in Scala.js support that can then be fixed separately.

If anyone has interest in giving a hand here, just reply to this thread and pick out one of the test suites to migrate over (some will be quite simple).

@jdegoes jdegoes added enhancement New feature or request good first issue Good for newcomers labels Apr 27, 2019
@jdegoes jdegoes added this to the 1.0.0 milestone Apr 27, 2019
@kamilkloch
Copy link
Contributor

TestRuntime.scala uses TerminationMatchers from specs2. TerminationMatchers cannot be used in Scala.js (reference to Thread.sleep). Any ideas?

@LGLO
Copy link
Contributor

LGLO commented Apr 28, 2019

Not every test requires TerminationMatchers, so we could split TestRuntime and put restricted version to shared.
Quick test: PromiseSpec and RefSpec pass tests. RefMSpec errors on tests of update and modify.

@vilu
Copy link
Contributor

vilu commented Apr 28, 2019

Is anyone actively working on this one? If not I would give it or a part of it a go late next week.

@LGLO
Copy link
Contributor

LGLO commented Apr 28, 2019

@vilu this issue can be split to many small PRs.

@mgibowski
Copy link
Contributor

I take two easy ones for the start: ArbitraryCause.scala and GenIO.scala.
The migration is so simple that I will put it into one PR.

@mgibowski
Copy link
Contributor

If anybody is interested in stm/STMSpec.scala, take a look at this first: #803

Dan-M added a commit to Dan-M/scalaz-zio that referenced this issue May 2, 2019
* upstream/master:
  Cats Effect: STM & TRef zio#791 (zio#796)
  increase RS TCK timeouts in interopRS tests (zio#806)
  zio#804 Move ArbitraryCause.scala and GenIO.scala to shared (zio#809)
  docfix: Minor scaladoc fix
@mgibowski
Copy link
Contributor

Today I migrate RefSpec.scala and FunctionIOSpec.scala.

Dan-M added a commit to Dan-M/scalaz-zio that referenced this issue May 4, 2019
* upstream/master:
  Duration and DurationSyntax specs moved to shared test sources. (zio#813)
  Move FunctionIOSpec.scala to 'shared' (zio#804)
  Move RefSpec.scala to 'shared' (zio#804)
  Cats Effect: TPromise, TQueue, TSemaphore zio#791 (zio#814)
@LGLO
Copy link
Contributor

LGLO commented May 4, 2019

My idea for some other tests is to replace runSync, which is disallowed in JS, with unsafeRunToFuture, so tests return Future[MatchResult[T]]. Then we can use specs2 Around that uses java.util.Timer and scala.concurrent.Promise to create Future with timeout.
WDYT guys?

ghostdogpr pushed a commit to ghostdogpr/scalaz-zio that referenced this issue May 5, 2019
* Move ArbitraryCause.scala to 'shared' (zio#804)

* Move GenIO.scala to 'shared' (zio#804)
ghostdogpr pushed a commit to ghostdogpr/scalaz-zio that referenced this issue May 5, 2019
ghostdogpr pushed a commit to ghostdogpr/scalaz-zio that referenced this issue May 5, 2019
@LGLO
Copy link
Contributor

LGLO commented May 6, 2019

We can't block for result in scala-js, scalacheck is 100% synchronous on the other hand.
forAll tests will be challenging. Doable but I think we'll have to write quite a chunk of code to cover forAll.

vilu added a commit to vilu/scalaz-zio that referenced this issue May 12, 2019
@vilu
Copy link
Contributor

vilu commented May 12, 2019

I was looking into PlatformSpec, should this one be really be considered in this ticket seeing how the implementation differs between js/jvm? Maybe just removing this one from the list would make sense?

vilu added a commit to vilu/scalaz-zio that referenced this issue May 12, 2019
LGLO added a commit that referenced this issue May 14, 2019
#804 Move ExitSpec from jvm to shared
LGLO added a commit that referenced this issue May 14, 2019
#804 - Move promise spec from core-jvm to core-shared
@ghostdogpr ghostdogpr added this to Tests in Warsaw Hackathon Sep 3, 2019
@iravid iravid added this to Tests in Warsaw Hackathon Sep 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
No open projects
Development

No branches or pull requests

6 participants