File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
packages/npm-packages/ruby-wasm-wasi/test/unit Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,9 @@ def await
8787 unless sched
8888 raise "Please start Ruby evaluation with RubyVM.eval_async to use JS::Object#await"
8989 end
90- sched . await ( self )
90+ # Promise.resolve wrap a value or flattens promise-like object and its thenable chain
91+ promise = JS . global [ :Promise ] . resolve ( self )
92+ sched . await ( promise )
9193 end
9294end
9395
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ def test_await_promise_chained
1818 assert_equal 43 , promise . await . to_i
1919 end
2020
21- # def test_await_non_promise
22- # assert_equal 42, JS.eval("return 42").await.to_i
23- # end
21+ def test_await_non_promise
22+ assert_equal 42 , JS . eval ( "return 42" ) . await . to_i
23+ end
2424end
You can’t perform that action at this time.
0 commit comments