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

Scala.js tests - no logging plus a delayed pop up #263

Closed
Quafadas opened this issue Apr 19, 2021 · 4 comments · Fixed by #267
Closed

Scala.js tests - no logging plus a delayed pop up #263

Quafadas opened this issue Apr 19, 2021 · 4 comments · Fixed by #267

Comments

@Quafadas
Copy link

Quafadas commented Apr 19, 2021

Using metals / vcscode

  1. clone https://github.com/keynmol/http4s-laminar-stack
  2. manually modify frontend-test.json, find the line "jsdom" and set to include (see issue filed against bloop) Bug: jsdom hardcoded to false in Scala.js projects scalacenter/bloop#1489, but unrelated to this bug)
  3. Add this test;
  loggedTest("test with side-effects and a logger"){ log =>
    for {
      x <- random
      _ <- log.info(s"x : $x")
      y <- random
      _ <- log.info(s"y : $y")
    } yield expect(x == y)
  }

I observe two undesirable behaviours.

  1. No logging on the failed test, which would appear to not be in line with the docs
  2. The tests complete as expected in the debug console. After about 15 seconds, a popup saying;
Could not start debuggee due to: Task timed-out after 15 seconds of inactivity

appears, which is rather disruptive to workflow.

I posted this on Gitter and was asked to submit an issue here.

@Quafadas Quafadas changed the title Scala.js tests - no logging / pop ups Scala.js tests - no logging plus a delayed pop up Apr 19, 2021
@keynmol
Copy link
Collaborator

keynmol commented Apr 19, 2021

Thanks for the issue.

I've actually pre-emptively investigated this and found the root cause:

  1. This only affects Scala.js
  2. It's not a new regression

The root cause is:

  1. We use scala-java-time to format timestamps
  2. We attempt to use the system's default timezone to do that
  3. Problem is, Scala.js doesn't come with timezones pre-baked (unlike JVM)
  4. There's a swallowed runtime exception when trying to format failures on Scala.js
  5. The timezone implementations realistically live in this dependency:
"io.github.cquiroz" %%% "scala-java-time-tzdb"   % "2.2.1" % Test

In fact, if you add it to the build it should resolve the issue.

There are several ways this can be "fixed" in weaver itself - I'm just evaluating options.

The fact that this was never caught is because our own tests use this dependency: https://github.com/disneystreaming/weaver-test/blob/master/build.sbt#L216

And the exception being thrown is the same as this issue: cquiroz/scala-java-time#257

@Quafadas
Copy link
Author

Er, wow. That was fast. Thanks for the workaround.

@keynmol
Copy link
Collaborator

keynmol commented Apr 19, 2021

I'm just happy it was so simple and will not require a scala.js runner rewrite :)

@Quafadas
Copy link
Author

I've added that dependancy to the build, I get logging now, but still the pop up. Should the pop up be filed against metals?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants