use Net::EmptyPort qw(wait_port empty_port);
use Try::Tiny;
use Plack::Builder;
-
-eval { require Catalyst::Devel; Catalyst::Devel->VERSION(1.0); 1; } || do {
- fail("Could not load Catalyst::Devel: $@");
- exit 1;
-};
-
-eval { require File::Copy::Recursive; 1 } || do {
- fail("Could not load File::Copy::Recursive: $@");
- exit 1;
-};
+use lib 't/lib';
+use MakeTestApp;
# Run a single test by providing it as the first arg
my $single_test = shift;
-my $tmpdir = "$FindBin::Bin/../../t/tmp";
-
-# clean up
-rmtree $tmpdir if -d $tmpdir;
-
-# create a TestApp and copy the test libs into it
-mkdir $tmpdir;
-chdir $tmpdir;
-system( $^X, "-I$FindBin::Bin/../../lib", "$FindBin::Bin/../../script/catalyst.pl", 'TestApp' );
-chdir "$FindBin::Bin/..";
-File::Copy::Recursive::dircopy( '../t/lib', '../t/tmp/TestApp/lib' ) or die;
-
-# remove TestApp's tests
-rmtree '../t/tmp/TestApp/t' or die;
+my $test_app_dir = make_test_app;
# spawn the standalone HTTP server
my $port = empty_port;
wait_port_timeout($port, 30);
} elsif ($pid == 0) {
# child process
- unshift @INC, "$tmpdir/TestApp/lib", "$FindBin::Bin/../../lib";
+ unshift @INC, "$test_app_dir/lib", "$FindBin::Bin/../../lib";
require TestApp;
my $psgi_app = TestApp->apply_default_middlewares(TestApp->psgi_app);
if (!(my $pid = fork)) {
require TAP::Harness;
- my $aggr = -e '.aggregating';
my $harness = TAP::Harness->new({
- ($aggr ? (test_args => \@tests) : ()),
lib => ['lib'],
});
- my $aggregator = $aggr
- ? $harness->runtests('t/aggregate.t')
- : $harness->runtests(@tests);
+ my $aggregator = $harness->runtests(@tests);
exit $aggregator->has_errors ? 1 : 0;
} else {