Skip to content

Commit 74de0dc

Browse files
Eval async code as top level code
1 parent a81cb61 commit 74de0dc

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

ext/js/lib/js.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ def self.__eval_async_rb(rb_code, future)
6767
Fiber
6868
.new do
6969
future.resolve JS::Object.wrap(
70-
Kernel.eval(rb_code.to_s, nil, "eval_async")
70+
Kernel.eval(
71+
rb_code.to_s,
72+
TOPLEVEL_BINDING,
73+
"eval_async"
74+
)
7175
)
7276
rescue => e
7377
future.reject JS::Object.wrap(e)

packages/npm-packages/ruby-wasm-wasi/tools/run-test-unit.mjs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ const main = async () => {
5353

5454
Error.stackTraceLimit = Infinity;
5555

56-
// FIXME: require 'test/unit' fails with evalAsync due to Kernel#eval (?)
57-
vm.eval(`
56+
await vm.evalAsync(`
5857
# HACK: Until we've fixed the issue in the test-unit or power_assert
5958
# See https://github.com/test-unit/test-unit/pull/221
6059
module Kernel
@@ -69,8 +68,6 @@ const main = async () => {
6968
end
7069
7170
require 'test/unit'
72-
`);
73-
await vm.evalAsync(`
7471
require_relative '${rootTestFile}'
7572
Test::Unit::AutoRunner.run
7673
`);

0 commit comments

Comments
 (0)