Skip to content

Commit 8eff75d

Browse files
committed
Stabilize tests by injecting no_app_path => 1 into yath() test runs.
Injected a few .gitignores too.
1 parent 9345053 commit 8eff75d

3 files changed

Lines changed: 55 additions & 47 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*.o
55
*.pm.tdy
66
*.bs
7+
*.ERR
8+
*.bak
79

810
# Devel::Cover
911
cover_db/

Changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Revision history for Test2-Harness-Renderer-JUnit
33
1.000005 2023-12-28 - Todd Rinaldo
44
- #15 - Fix POD Control sequence
55
- #17 - Allow for set_no_numbers format
6+
- Stabilize tests by injecting no_app_path => 1 into yath() test runs.
67

78
1.000004 2021-05-13 - Todd Rinaldo
89
- Don't fail the whole run when you see a duplicate test. Just ammend the failure message.

t/test.t

Lines changed: 52 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use App::Yath::Tester qw/yath/;
1010
use Test2::Harness::Util::File::JSONL ();
1111
use Test2::Harness::Renderer::JUnit ();
1212

13-
use Test2::Harness::Util qw/clean_path/;
13+
use Test2::Harness::Util qw/clean_path/;
1414
use Test2::Harness::Util::JSON qw/decode_json/;
1515

1616
#use Test2::Bundle::Extended;
@@ -43,11 +43,12 @@ my $env = { # env passed to yath
4343
unlink $default_junit_xml if -e $default_junit_xml;
4444

4545
yath(
46-
command => 'test',
47-
args => [ $sdir, '--ext=tx', @renderers, '-v' ],
48-
exit => 0,
49-
env => $env,
50-
test => sub {
46+
command => 'test',
47+
args => [ $sdir, '--ext=tx', @renderers, '-v' ],
48+
exit => 0,
49+
env => $env,
50+
no_app_path => 1,
51+
test => sub {
5152
my $out = shift;
5253

5354
like(
@@ -72,19 +73,19 @@ my $env = { # env passed to yath
7273
}
7374

7475
{
75-
note
76-
"all tests are ok - JUNIT_TEST_FILE not reachable - No such file or directory";
76+
note "all tests are ok - JUNIT_TEST_FILE not reachable - No such file or directory";
7777

7878
my $sdir = $dir . '-ok';
7979

8080
$env->{JUNIT_TEST_FILE} = "$tmpdir/x/y/z/ok.xml";
8181

8282
yath(
83-
command => 'test',
84-
args => [ $sdir, '--ext=tx', @renderers, '-v' ],
85-
exit => T(),
86-
env => $env,
87-
test => sub {
83+
command => 'test',
84+
args => [ $sdir, '--ext=tx', @renderers, '-v' ],
85+
exit => T(),
86+
env => $env,
87+
no_app_path => 1,
88+
test => sub {
8889
my $out = shift;
8990

9091
like(
@@ -115,11 +116,12 @@ my $env = { # env passed to yath
115116
$env->{JUNIT_TEST_FILE} = "$tmpdir/ok.xml";
116117

117118
yath(
118-
command => 'test',
119-
args => [ $sdir, '--ext=tx', @renderers, '-v' ],
120-
exit => 0,
121-
env => $env,
122-
test => sub {
119+
command => 'test',
120+
args => [ $sdir, '--ext=tx', @renderers, '-v' ],
121+
exit => 0,
122+
env => $env,
123+
no_app_path => 1,
124+
test => sub {
123125
my $out = shift;
124126

125127
like(
@@ -219,11 +221,12 @@ my $env = { # env passed to yath
219221
$env->{JUNIT_TEST_FILE} = "$tmpdir/no-numbers.xml";
220222

221223
yath(
222-
command => 'test',
223-
args => [ $sdir, '--ext=tx', @renderers, '-v' ],
224-
exit => 0,
225-
env => $env,
226-
test => sub {
224+
command => 'test',
225+
args => [ $sdir, '--ext=tx', @renderers, '-v' ],
226+
exit => 0,
227+
env => $env,
228+
no_app_path => 1,
229+
test => sub {
227230
my $out = shift;
228231

229232
like(
@@ -285,11 +288,12 @@ my $env = { # env passed to yath
285288
$env->{JUNIT_TEST_FILE} = "$tmpdir/failure.xml";
286289

287290
yath(
288-
command => 'test',
289-
args => [ $sdir, '--ext=tx', @renderers, '-v' ],
290-
exit => T(),
291-
env => $env,
292-
test => sub {
291+
command => 'test',
292+
args => [ $sdir, '--ext=tx', @renderers, '-v' ],
293+
exit => T(),
294+
env => $env,
295+
no_app_path => 1,
296+
test => sub {
293297
my $out = shift;
294298

295299
like(
@@ -326,8 +330,7 @@ my $env = { # env passed to yath
326330
field classname => 'test-fail_fail_tx';
327331
field time => D();
328332
field failure => hash {
329-
field content => match
330-
qr{not ok 0002 - this is a failure};
333+
field content => match qr{not ok 0002 - this is a failure};
331334
field message => 'not ok 0002 - this is a failure';
332335
field type => 'TestFailed';
333336
};
@@ -363,11 +366,12 @@ my $env = { # env passed to yath
363366
$env->{JUNIT_TEST_FILE} = "$tmpdir/plan.xml";
364367

365368
yath(
366-
command => 'test',
367-
args => [ $sdir, '--ext=tx', @renderers, '-v' ],
368-
exit => T(),
369-
env => $env,
370-
test => sub {
369+
command => 'test',
370+
args => [ $sdir, '--ext=tx', @renderers, '-v' ],
371+
exit => T(),
372+
env => $env,
373+
no_app_path => 1,
374+
test => sub {
371375
my $out = shift;
372376

373377
like(
@@ -414,8 +418,7 @@ my $env = { # env passed to yath
414418
field 'Test Plan Failure' => hash {
415419
field classname => 'test-plan_plan_tx';
416420
field time => D();
417-
field failure => match
418-
q[Planned for 4 assertions, but saw 2];
421+
field failure => match q[Planned for 4 assertions, but saw 2];
419422
end;
420423
};
421424

@@ -443,11 +446,12 @@ my $env = { # env passed to yath
443446
$env->{JUNIT_TEST_FILE} = "$tmpdir/die.xml";
444447

445448
yath(
446-
command => 'test',
447-
args => [ $sdir, '--ext=tx', @renderers, '-v' ],
448-
exit => T(),
449-
env => $env,
450-
test => sub {
449+
command => 'test',
450+
args => [ $sdir, '--ext=tx', @renderers, '-v' ],
451+
exit => T(),
452+
env => $env,
453+
no_app_path => 1,
454+
test => sub {
451455
my $out = shift;
452456

453457
like(
@@ -522,11 +526,12 @@ my $env = { # env passed to yath
522526
$env->{FAIL_ONCE} = 1;
523527

524528
yath(
525-
command => 'test',
526-
args => [ $sdir, '--ext=tx', @renderers, '-v', '--retry=1', ],
527-
exit => 0,
528-
env => $env,
529-
test => sub {
529+
command => 'test',
530+
args => [ $sdir, '--ext=tx', @renderers, '-v', '--retry=1', ],
531+
exit => 0,
532+
env => $env,
533+
no_app_path => 1,
534+
test => sub {
530535
my $out = shift;
531536

532537
like( $out->{output}, qr{FAIL.*Should fail once}, "one failure" );

0 commit comments

Comments
 (0)