From f93f5e01faca56a81788822cf653279b5305c390 Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Wed, 4 Sep 2024 10:53:33 +1000 Subject: [PATCH] account for slower machine and provide better error message to failing test --- test/mini_racer_test.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/mini_racer_test.rb b/test/mini_racer_test.rb index d6dc504..c82d06b 100644 --- a/test/mini_racer_test.rb +++ b/test/mini_racer_test.rb @@ -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 @@ -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 @@ -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