Skip to content

Commit 92b4243

Browse files
Wrap docstring tests in async context to make "toplevel" await work
1 parent 74d2492 commit 92b4243

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

tests/docstring_tests/DocTest.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ let main = async () => {
141141
} else {
142142
// Let's add the examples inside a Test module because some examples
143143
// have type definitions that are not supported inside a block.
144-
// Also add unit type `()`
144+
// Also add unit type `()`. Also wrap in async to make top-level awaits work.
145145
Some(
146-
`test("${example.name}", () => {
146+
`testAsync("${example.name}", async () => {
147147
module Test = {
148148
${code}
149149
}

tests/docstring_tests/DocTest.res.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/docstring_tests/Mocha.res

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
@module("mocha")
22
external test: (string, unit => unit) => unit = "test"
33

4+
@module("mocha")
5+
external testAsync: (string, unit => promise<unit>) => unit = "test"
6+
47
@module("mocha")
58
external describe: (string, unit => unit) => unit = "describe"

0 commit comments

Comments
 (0)