1 |
package Frey::Test::Runner; |
2 |
use Moose; |
3 |
|
4 |
extends 'Frey'; |
5 |
with 'Frey::Web'; |
6 |
|
7 |
use TAP::Harness; |
8 |
use TAP::Formatter::HTML; |
9 |
use Data::Dump qw/dump/; |
10 |
|
11 |
has tests => ( |
12 |
is => 'rw', |
13 |
isa => 'ArrayRef[Str]', |
14 |
required => 1, |
15 |
lazy => 1, # FIXME ask users which tests to run |
16 |
default => sub { [ glob('t/*.t') ] }, |
17 |
); |
18 |
|
19 |
sub as_markup { |
20 |
my ($self) = @_; |
21 |
|
22 |
my $f = TAP::Formatter::HTML->new({ |
23 |
silent => 1, |
24 |
|
25 |
inline_css => 1, |
26 |
inline_js => 1, |
27 |
}); |
28 |
my $h = TAP::Harness->new({ |
29 |
merge => 1, |
30 |
formatter => $f, |
31 |
}); |
32 |
|
33 |
my @tests = grep { ! m{$0} } @{ $self->tests }; # FIXME privitive way to break recursion |
34 |
warn "testing ",dump( @tests ); |
35 |
$h->runtests( @tests ); |
36 |
|
37 |
my $html = ${ $f->html }; |
38 |
# warn $html; |
39 |
warn "got ",length($html), " bytes"; |
40 |
# $html =~ s{^.*<body>}{}s; |
41 |
# $html =~ s{</body>.*$}{}s; |
42 |
return $self->editor_links( $html ); |
43 |
} |
44 |
|
45 |
1; |