@Test public void runTest() throws Throwable { if (!test.isValidTest(isStrictTest, unmarkedDefault)) { return; } // Evaluate actual test-script if (test.isModule()) { global.evalModule(test.toModuleName(), sourceCode, 1 - preambleLines); } else { global.eval(test.toFile(), sourceCode, 1 - preambleLines); } // Wait for pending tasks to finish if (test.isAsync()) { assertFalse(async.doneCalled); global.getRealm().getWorld().runEventLoop(); assertTrue(async.doneCalled); } else { global.getRealm().getWorld().runEventLoop(); } }