Skip to content

Commit

Permalink
account for slower machine and provide better error message to failin…
Browse files Browse the repository at this point in the history
…g test
  • Loading branch information
SamSaffron committed Sep 4, 2024
1 parent a9103b1 commit f93f5e0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/mini_racer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ def test_function_rval

def test_timeout_in_ruby_land
context = MiniRacer::Context.new(timeout: 50)
context.attach("sleep", proc { sleep 0.5 })
context.attach("sleep", proc { sleep 10 })
assert_raises(MiniRacer::ScriptTerminatedError) do
context.eval('sleep(); "hi";')
end
Expand Down Expand Up @@ -786,12 +786,12 @@ def test_estimated_size
skip "TruffleRuby does not yet implement heap_stats"
end
context = MiniRacer::Context.new(timeout: 500)
context.eval(<<-JS)
let a='testing';
let f=function(foo) { foo + 42 };
context.eval(<<~JS)
let a='testing';
let f=function(foo) { foo + 42 };
// call `f` a lot to have things JIT'd so that total_heap_size_executable becomes > 0
for (let i = 0; i < 1000000; i++) { f(10); }
// call `f` a lot to have things JIT'd so that total_heap_size_executable becomes > 0
for (let i = 0; i < 1000000; i++) { f(10); }
JS

stats = context.heap_stats
Expand All @@ -809,7 +809,7 @@ def test_estimated_size

assert(
stats.values.all? { |v| v > 0 },
"expecting the isolate to have values for all the vals"
"expecting the isolate to have values for all the vals: actual stats #{stats}"
)
end

Expand Down

0 comments on commit f93f5e0

Please sign in to comment.