Skip to content

Commit 284e309

Browse files
committed
Fix prePR and CI
1 parent 453c4cb commit 284e309

File tree

4 files changed

+40
-17
lines changed

4 files changed

+40
-17
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
run: sbt -DCI=1 "++${{ matrix.scalaversion }}" test package doc
2626

2727
- name: Validate formatting
28-
run: sbt -DCI=1 "++${{ matrix.scalaversion }}" scalafmtCheck
28+
run: sbt -DCI=1 "++${{ matrix.scalaversion }}" dom/scalafmtCheck
2929

3030
- name: Validate api report
3131
if: matrix.scalaversion != '2.11.12' && matrix.scalaversion != '3.0.1'

prePR.sbt

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,43 @@ addCommandAlias("prePR", "+prePR_nonCross")
44

55
val prePR_nonCross = taskKey[Unit]("Performs all necessary work required before submitting a PR, for a single version of Scala.")
66

7+
// Unfortunately we can't just call `root/Test/compile` because it doesn't take aggregation into account :(
78
ThisBuild / prePR_nonCross := Def.sequential(
8-
root / clean,
9+
10+
Def.task {
11+
(root / clean).value
12+
(scalafixRules / clean).value
13+
(dom / clean).value
14+
(testsShared / clean).value
15+
(testsWebworker / clean).value
16+
(testsChrome / clean).value
17+
(testsFirefox / clean).value
18+
(testsNodeJsdom / clean).value
19+
(example / clean).value
20+
},
21+
922
dom / Compile / scalafmt,
1023
Def.taskDyn {
1124
if (scalaVersion.value.startsWith("2."))
1225
(dom / Compile / scalafix).toTask("")
1326
else
1427
Def.task[Unit]((dom / Compile / compile).value)
1528
},
16-
root / Test / compile,
29+
30+
Def.task {
31+
(testsShared / Test / compile).value
32+
(testsWebworker / Test / compile).value
33+
(testsChrome / Test / compile).value
34+
(testsFirefox / Test / compile).value
35+
(testsNodeJsdom / Test / compile).value
36+
(example / Test / compile).value
37+
},
38+
1739
Def.taskDyn {
1840
if (scalaVersion.value.startsWith("2.12."))
1941
Def.task[Unit]((readme / Compile / compile).value)
2042
else
2143
Def.task(())
2244
},
45+
2346
).value

tests-shared/src/main/scala/org/scalajs/dom/tests/shared/AsyncTesting.scala

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@ object AsyncTesting {
99

1010
type AsyncResult = Future[Try[Unit]]
1111

12-
implicit final def global: ExecutionContext =
12+
implicit def global: ExecutionContext =
1313
ExecutionContext.global
1414

1515
def async(run: => Future[Any]): AsyncResult = {
16-
val p = Promise[Try[Unit]]()
17-
val timeout = setTimeout(1200) {
18-
p.tryComplete(Failure(new RuntimeException("Test timed out.")))
19-
}
20-
setTimeout(1) {
21-
p.completeWith(run.transform { ta =>
22-
clearTimeout(timeout)
23-
Success(ta.map(_ => ()))
24-
})
25-
}
26-
p.future
16+
val p = Promise[Try[Unit]]()
17+
val timeout = setTimeout(1200) {
18+
p.tryComplete(Failure(new RuntimeException("Test timed out.")))
19+
}
20+
setTimeout(1) {
21+
p.completeWith(run.transform { ta =>
22+
clearTimeout(timeout)
23+
Success(ta.map(_ => ()))
24+
})
25+
}
26+
p.future
2727
}
2828

29-
implicit class AsyncFutureOps[A](private val self: Future[A]) extends AnyVal {
29+
implicit final class AsyncFutureOps[A](private val self: Future[A]) extends AnyVal {
3030
def tap(f: A => Any): Future[A] =
3131
self.map { a => f(a); a }
3232

tests-webworker/src/main/scala/org/scalajs/dom/tests/webworker/WebWorkerTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import WebWorkerCmd._
2929
trait WebWorkerTests {
3030
import Client.{global => client}
3131

32-
final def webWorkerTest(test: (WebWorkerCmd, String)) = async {
32+
final protected def webWorkerTest(test: (WebWorkerCmd, String)) = async {
3333
client.send(test._1).assertEquals(test._2)
3434
}
3535

0 commit comments

Comments
 (0)