use Mojolicious::Lite;
any '/' => 'main';
use Test::More;
use Test::Mojo::WithRoles qw/Phantom/;
my $t = Test::Mojo::WithRoles->new;
my $js = <<'JS';
throw 'foo';
JS
$t->phantom_ok('main', $js);
done_testing;
__DATA__
@@ main.html.ep
<!DOCTYPE html>
<html>
<head></head>
<body>
</body>
</html>
Because the exception is thrown before the code gets to the phantom.exit() the test hangs. Worse there isn't a diagnostic. Wrapping my code in an eval helps:
Consider:
Because the exception is thrown before the code gets to the
phantom.exit()
the test hangs. Worse there isn't a diagnostic. Wrapping my code in an eval helps:This might be a sane default (?), but does not help for a syntax error which also exhibits the same hang with no diagnostic.