From 8eff75d65709c717ff9c4da760bb623784a199ce Mon Sep 17 00:00:00 2001 From: Todd Rinaldo Date: Thu, 28 Dec 2023 16:49:22 +0000 Subject: [PATCH] Stabilize tests by injecting no_app_path => 1 into yath() test runs. Injected a few .gitignores too. --- .gitignore | 2 ++ Changes | 1 + t/test.t | 99 ++++++++++++++++++++++++++++-------------------------- 3 files changed, 55 insertions(+), 47 deletions(-) diff --git a/.gitignore b/.gitignore index a07fb8e..f3398f8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ *.o *.pm.tdy *.bs +*.ERR +*.bak # Devel::Cover cover_db/ diff --git a/Changes b/Changes index a3d0dcf..fb36101 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,7 @@ Revision history for Test2-Harness-Renderer-JUnit 1.000005 2023-12-28 - Todd Rinaldo - #15 - Fix POD Control sequence - #17 - Allow for set_no_numbers format +- Stabilize tests by injecting no_app_path => 1 into yath() test runs. 1.000004 2021-05-13 - Todd Rinaldo - Don't fail the whole run when you see a duplicate test. Just ammend the failure message. diff --git a/t/test.t b/t/test.t index 9d38388..42eb709 100644 --- a/t/test.t +++ b/t/test.t @@ -10,7 +10,7 @@ use App::Yath::Tester qw/yath/; use Test2::Harness::Util::File::JSONL (); use Test2::Harness::Renderer::JUnit (); -use Test2::Harness::Util qw/clean_path/; +use Test2::Harness::Util qw/clean_path/; use Test2::Harness::Util::JSON qw/decode_json/; #use Test2::Bundle::Extended; @@ -43,11 +43,12 @@ my $env = { # env passed to yath unlink $default_junit_xml if -e $default_junit_xml; yath( - command => 'test', - args => [ $sdir, '--ext=tx', @renderers, '-v' ], - exit => 0, - env => $env, - test => sub { + command => 'test', + args => [ $sdir, '--ext=tx', @renderers, '-v' ], + exit => 0, + env => $env, + no_app_path => 1, + test => sub { my $out = shift; like( @@ -72,19 +73,19 @@ my $env = { # env passed to yath } { - note - "all tests are ok - JUNIT_TEST_FILE not reachable - No such file or directory"; + note "all tests are ok - JUNIT_TEST_FILE not reachable - No such file or directory"; my $sdir = $dir . '-ok'; $env->{JUNIT_TEST_FILE} = "$tmpdir/x/y/z/ok.xml"; yath( - command => 'test', - args => [ $sdir, '--ext=tx', @renderers, '-v' ], - exit => T(), - env => $env, - test => sub { + command => 'test', + args => [ $sdir, '--ext=tx', @renderers, '-v' ], + exit => T(), + env => $env, + no_app_path => 1, + test => sub { my $out = shift; like( @@ -115,11 +116,12 @@ my $env = { # env passed to yath $env->{JUNIT_TEST_FILE} = "$tmpdir/ok.xml"; yath( - command => 'test', - args => [ $sdir, '--ext=tx', @renderers, '-v' ], - exit => 0, - env => $env, - test => sub { + command => 'test', + args => [ $sdir, '--ext=tx', @renderers, '-v' ], + exit => 0, + env => $env, + no_app_path => 1, + test => sub { my $out = shift; like( @@ -219,11 +221,12 @@ my $env = { # env passed to yath $env->{JUNIT_TEST_FILE} = "$tmpdir/no-numbers.xml"; yath( - command => 'test', - args => [ $sdir, '--ext=tx', @renderers, '-v' ], - exit => 0, - env => $env, - test => sub { + command => 'test', + args => [ $sdir, '--ext=tx', @renderers, '-v' ], + exit => 0, + env => $env, + no_app_path => 1, + test => sub { my $out = shift; like( @@ -285,11 +288,12 @@ my $env = { # env passed to yath $env->{JUNIT_TEST_FILE} = "$tmpdir/failure.xml"; yath( - command => 'test', - args => [ $sdir, '--ext=tx', @renderers, '-v' ], - exit => T(), - env => $env, - test => sub { + command => 'test', + args => [ $sdir, '--ext=tx', @renderers, '-v' ], + exit => T(), + env => $env, + no_app_path => 1, + test => sub { my $out = shift; like( @@ -326,8 +330,7 @@ my $env = { # env passed to yath field classname => 'test-fail_fail_tx'; field time => D(); field failure => hash { - field content => match - qr{not ok 0002 - this is a failure}; + field content => match qr{not ok 0002 - this is a failure}; field message => 'not ok 0002 - this is a failure'; field type => 'TestFailed'; }; @@ -363,11 +366,12 @@ my $env = { # env passed to yath $env->{JUNIT_TEST_FILE} = "$tmpdir/plan.xml"; yath( - command => 'test', - args => [ $sdir, '--ext=tx', @renderers, '-v' ], - exit => T(), - env => $env, - test => sub { + command => 'test', + args => [ $sdir, '--ext=tx', @renderers, '-v' ], + exit => T(), + env => $env, + no_app_path => 1, + test => sub { my $out = shift; like( @@ -414,8 +418,7 @@ my $env = { # env passed to yath field 'Test Plan Failure' => hash { field classname => 'test-plan_plan_tx'; field time => D(); - field failure => match - q[Planned for 4 assertions, but saw 2]; + field failure => match q[Planned for 4 assertions, but saw 2]; end; }; @@ -443,11 +446,12 @@ my $env = { # env passed to yath $env->{JUNIT_TEST_FILE} = "$tmpdir/die.xml"; yath( - command => 'test', - args => [ $sdir, '--ext=tx', @renderers, '-v' ], - exit => T(), - env => $env, - test => sub { + command => 'test', + args => [ $sdir, '--ext=tx', @renderers, '-v' ], + exit => T(), + env => $env, + no_app_path => 1, + test => sub { my $out = shift; like( @@ -522,11 +526,12 @@ my $env = { # env passed to yath $env->{FAIL_ONCE} = 1; yath( - command => 'test', - args => [ $sdir, '--ext=tx', @renderers, '-v', '--retry=1', ], - exit => 0, - env => $env, - test => sub { + command => 'test', + args => [ $sdir, '--ext=tx', @renderers, '-v', '--retry=1', ], + exit => 0, + env => $env, + no_app_path => 1, + test => sub { my $out = shift; like( $out->{output}, qr{FAIL.*Should fail once}, "one failure" );