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

Release Scala.js artifacts for Dotty builds #199

Closed
mpilquist opened this issue Sep 14, 2020 · 5 comments · Fixed by #248
Closed

Release Scala.js artifacts for Dotty builds #199

mpilquist opened this issue Sep 14, 2020 · 5 comments · Fixed by #248
Labels
help wanted Extra attention is needed

Comments

@mpilquist
Copy link

As of Dotty 0.27.0-RC1, we can start releasing Dotty Scala.js artifacts.

@olafurpg olafurpg added the help wanted Extra attention is needed label Sep 15, 2020
@olafurpg
Copy link
Member

Thank you for reporting! I took a stab at implementing this here https://github.com/scalameta/munit/compare/master...olafurpg:dotty-js?expand=1 but I'm getting the error below

==> X munit.LinesSuite.basic 0.02s scala.scalajs.js.JavaScriptException: ReferenceError: JSPath is not defined
    at java.io.File$.separator(/Users/lgeirsson/dev/munit/tests/js/target/scala-0.27/tests-test-fastopt.js:733)
    at munit.Location.filename(/Users/lgeirsson/dev/munit/tests/js/target/scala-0.27/tests-test-fastopt.js:27493)
    at <jscode>.test__Lmunit_TestOptions__F0__Lmunit_Location__V.$c_sjsr_AnonFunction0(/Users/lgeirsson/dev/munit/tests/js/target/scala-0.27/tests-test-fastopt.js:53726)
    at scala.scalajs.runtime.AnonFunction0.apply(/Users/lgeirsson/dev/munit/tests/js/target/scala-0.27/tests-test-fastopt.js:32951)

If there was a way to make this method here return false then I think the problem would be fixed

def isNode: Boolean = !js.isUndefined(process) && !js.isUndefined(process.cwd)

Any help in this area would be greatly appreciated! cc/ @sjrd

@sjrd
Copy link

sjrd commented Sep 15, 2020

The error you are experiencing is a bug in the Scala.js support in dotty, which will be fixed in scala/scala3#9767. You'll probably have to wait for the next release.

Independently, your def isNode implementation looks buggy in Scala.js 1.x, whether for Scala 2 or 3. You should use js.typeOf instead:

js.typeOf(process) != "undefined" && js.typeOf(process.cwd) != "undefined"

The js.isUndefined(process) will throw a ReferenceError if process is not defined. (In 0.6.x it would have returned undefined, but not in 1.x.)

@olafurpg
Copy link
Member

Thank you @sjrd ! I will wait until the next release then.

@smarter
Copy link

smarter commented Nov 7, 2020

I will wait until the next release then.

3.0.0-M1 has been released with the fix for the aforementioned bug. (Note that there's one known bug in the Scala.js support of M1 you may or may not run into with a workaround documented at: scala/scala3#10177).

@larsrh
Copy link
Contributor

larsrh commented Nov 8, 2020

#248 adds DottyJS support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants