Mojolicious-Plugin-BarefootJS

 view release on metacpan or  search on metacpan

t/dev_reload.t  view on Meta::CPAN

    return { status => $status, headers => \%resp_headers, body => $body };
}

# Build a minimal Mojolicious::Lite app with the DevReload plugin and a
# configurable dist dir so tests can pre-seed the sentinel file.
sub build_app ($dist_dir, %plugin_opts) {
    my $app = Mojolicious::Lite->new;
    $app->plugin('BarefootJS::DevReload',
        { dist_dir => $dist_dir, %plugin_opts });
    my $t = Test::Mojo->new($app);
    # SSE endpoint streams forever; cap response + inactivity so streaming
    # tests don't hang. Applies to all tests using this app; harmless for
    # the non-streaming ones.
    $t->ua->max_response_size(4096);
    $t->ua->inactivity_timeout(2);
    return $t;
}

sub write_sentinel ($dist, $id) {
    my $dir = File::Spec->catdir($dist, '.dev');
    make_path($dir);
    open my $fh, '>', File::Spec->catfile($dir, 'build-id') or die $!;
    print $fh $id;



( run in 0.565 second using v1.01-cache-2.11-cpan-600a1bdf6e4 )