Skip to content

Enable/disable webworker test depending on JSEnv #20

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

Merged
merged 6 commits into from
Sep 7, 2021

Conversation

armanbilge
Copy link
Member

Since in CI we're only running the webworker tests in the appropriate environment anyway, we don't need this programmatic check for webworker support to decide whether to enable/disable the test. Instead, better the test fails rather than be silently ignored.

OTOH, this would break root/test. Thoughts?

@djspiewak
Copy link
Collaborator

Does munit have a "skipped" status for tests? That would be more semantic than failure.

@armanbilge
Copy link
Member Author

Good point, they have an ignore tag. I'll look into this.

@armanbilge
Copy link
Member Author

I guess the reason I'd prefer a failed test here (instead of ignored/skipped) is that if CI passes nobody checks the log (or at least, I don't 😝) in which case this could be easily overlooked. What we could do is ignore/skip for local but fail in CI.

@armanbilge armanbilge changed the title Don't automatically disable webworker test Enable/disable webworker test depending on JSEnv Sep 7, 2021
.foreach { _ =>
test("pass the MacrotaskSuite in a web worker") {
val p = Promise[Boolean]()
override def munitIgnore = !Set("Firefox", "Chrome").contains(BuildInfo.jsEnv)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@djspiewak how about this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put the browser check into the buildInfoKeys calculation instead? Basically turn the build info into something more like "isBrowser" -> .... That does a better job of centralizing things so that we can add/remove browsers more easily

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Also this is busted right now anyway lol.

.foreach { _ =>
test("pass the MacrotaskSuite in a web worker") {
val p = Promise[Boolean]()
override def munitIgnore = !Set("Firefox", "Chrome").contains(BuildInfo.jsEnv)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put the browser check into the buildInfoKeys calculation instead? Basically turn the build info into something more like "isBrowser" -> .... That does a better job of centralizing things so that we can add/remove browsers more easily

Comment on lines +69 to +72
addCommandAlias("ciNode", "; set Global / useJSEnv := JSEnv.NodeJS; test; core/doc")
addCommandAlias("ciFirefox", "; set Global / useJSEnv := JSEnv.Firefox; test; set Global / useJSEnv := JSEnv.NodeJS")
addCommandAlias("ciChrome", "; set Global / useJSEnv := JSEnv.Chrome; test; set Global / useJSEnv := JSEnv.NodeJS")
addCommandAlias("ciJSDOMNodeJS", "; set Global / useJSEnv := JSEnv.JSDOMNodeJS; test; set Global / useJSEnv := JSEnv.NodeJS")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how it was configured in CE. Just an omission, or is Global a weird/bad way to do things?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah. Global is actually fine and it is the correct thing to do here.

@armanbilge armanbilge requested a review from djspiewak September 7, 2021 17:49
@djspiewak djspiewak merged commit d57afef into scala-js:main Sep 7, 2021
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 this pull request may close these issues.

2 participants