Debian Codegraph @

lib/App/Yath/Command/stop.pm

raw
1 package App::Yath::Command::stop;
2 use strict;
3 use warnings;
4
5 our $VERSION = '1.000179';
6
7 use Time::HiRes qw/sleep/;
8
9 use File::Spec();
10
11 use Test2::Harness::Util::File::JSON();
12 use Test2::Harness::Util::Queue();
13
14 use Test2::Harness::Util qw/open_file/;
15 use App::Yath::Util qw/find_pfile/;
16 use File::Path qw/remove_tree/;
17
18 use parent 'App::Yath::Command::run';
19 use Test2::Harness::Util::HashBase;
20
21 sub group { 'persist' }
22
23 sub summary { "Stop the persistent test runner" }
24 sub cli_args { "" }
25
26 sub description {
27 return <<" EOT";
28 This command will stop a persistent instance, and output any log contents.
29 EOT
30 }
31
32 sub pfile_params { (no_fatal => 1) }
33
34 sub run {
35 my $self = shift;
36
37 $self->App::Yath::Command::test::terminate_queue();
38
39 $_->teardown($self->settings) for @{$self->settings->harness->plugins};
40
41 sleep(0.02) while kill(0, $self->pfile_data->{pid});
42
43 my $pfile = $self->pfile;
44 unlink($pfile) if -f $pfile;
45
46 remove_tree($self->workdir, {safe => 1, keep_root => 0}) if -d $self->workdir;
47
48 print "\n\nRunner stopped\n\n" unless $self->settings->display->quiet;
49 return 0;
50 }
51
52 1;
53
54 __END__
55
56 =pod
57
58 =encoding UTF-8
59
60 =head1 NAME
61
62 App::Yath::Command::stop - Stop the persistent test runner
63
64 =head1 DESCRIPTION
65
66 This command will stop a persistent instance, and output any log contents.
67
68
69 =head1 USAGE
70
71 $ yath [YATH OPTIONS] stop [COMMAND OPTIONS]
72
73 =head2 YATH OPTIONS
74
75 =head3 Developer
76
77 =over 4
78
79 =item --dev-lib
80
81 =item --dev-lib=lib
82
83 =item -D
84
85 =item -D=lib
86
87 =item -Dlib
88
89 =item --no-dev-lib
90
91 Add paths to @INC before loading ANYTHING. This is what you use if you are developing yath or yath plugins to make sure the yath script finds the local code instead of the installed versions of the same code. You can provide an argument (-Dfoo) to provide a custom path, or you can just use -D without and arg to add lib, blib/lib and blib/arch.
92
93 Can be specified multiple times
94
95
96 =back
97
98 =head3 Environment
99
100 =over 4
101
102 =item --persist-dir ARG
103
104 =item --persist-dir=ARG
105
106 =item --no-persist-dir
107
108 Where to find persistence files.
109
110
111 =item --persist-file ARG
112
113 =item --persist-file=ARG
114
115 =item --pfile ARG
116
117 =item --pfile=ARG
118
119 =item --no-persist-file
120
121 Where to find the persistence file. The default is /{system-tempdir}/project-yath-persist.json. If no project is specified then it will fall back to the current directory. If the current directory is not writable it will default to /tmp/yath-persist.json which limits you to one persistent runner on your system.
122
123
124 =item --project ARG
125
126 =item --project=ARG
127
128 =item --project-name ARG
129
130 =item --project-name=ARG
131
132 =item --no-project
133
134 This lets you provide a label for your current project/codebase. This is best used in a .yath.rc file. This is necessary for a persistent runner.
135
136
137 =back
138
139 =head3 Finder Options
140
141 =over 4
142
143 =item --finder MyFinder
144
145 =item --finder +Test2::Harness::Finder::MyFinder
146
147 =item --no-finder
148
149 Specify what Finder subclass to use when searching for files/processing the file list. Use the "+" prefix to specify a fully qualified namespace, otherwise Test2::Harness::Finder::XXX namespace is assumed.
150
151
152 =back
153
154 =head3 Help and Debugging
155
156 =over 4
157
158 =item --show-opts
159
160 =item --no-show-opts
161
162 Exit after showing what yath thinks your options mean
163
164
165 =item --version
166
167 =item -V
168
169 =item --no-version
170
171 Exit after showing a helpful usage message
172
173
174 =back
175
176 =head3 Plugins
177
178 =over 4
179
180 =item --no-scan-plugins
181
182 =item --no-no-scan-plugins
183
184 Normally yath scans for and loads all App::Yath::Plugin::* modules in order to bring in command-line options they may provide. This flag will disable that. This is useful if you have a naughty plugin that is loading other modules when it should not.
185
186
187 =item --plugins PLUGIN
188
189 =item --plugins +App::Yath::Plugin::PLUGIN
190
191 =item --plugins PLUGIN=arg1,arg2,...
192
193 =item --plugin PLUGIN
194
195 =item --plugin +App::Yath::Plugin::PLUGIN
196
197 =item --plugin PLUGIN=arg1,arg2,...
198
199 =item -pPLUGIN
200
201 =item --no-plugins
202
203 Load a yath plugin.
204
205 Can be specified multiple times
206
207
208 =back
209
210 =head2 COMMAND OPTIONS
211
212 =head3 Cover Options
213
214 =over 4
215
216 =item --cover-aggregator ByTest
217
218 =item --cover-aggregator ByRun
219
220 =item --cover-aggregator +Custom::Aggregator
221
222 =item --cover-agg ByTest
223
224 =item --cover-agg ByRun
225
226 =item --cover-agg +Custom::Aggregator
227
228 =item --no-cover-aggregator
229
230 Choose a custom aggregator subclass
231
232
233 =item --cover-class ARG
234
235 =item --cover-class=ARG
236
237 =item --no-cover-class
238
239 Choose a Test2::Plugin::Cover subclass
240
241
242 =item --cover-dirs ARG
243
244 =item --cover-dirs=ARG
245
246 =item --cover-dir ARG
247
248 =item --cover-dir=ARG
249
250 =item --no-cover-dirs
251
252 NO DESCRIPTION - FIX ME
253
254 Can be specified multiple times
255
256
257 =item --cover-exclude-dirs ARG
258
259 =item --cover-exclude-dirs=ARG
260
261 =item --cover-exclude-dir ARG
262
263 =item --cover-exclude-dir=ARG
264
265 =item --no-cover-exclude-dirs
266
267 Directory to leave out of file coverage and coverage metrics, along with everything under it at any depth. May be specified multiple times. Wildcards are expanded when the option is parsed, so a pattern matching nothing excludes nothing. Values are word-split first, so a path containing whitespace must be quoted or backslash-escaped. A resolved path may not contain a comma.
268
269 Can be specified multiple times
270
271
272 =item --cover-exclude-private
273
274 =item --no-cover-exclude-private
275
276
277
278
279 =item --cover-files
280
281 =item --no-cover-files
282
283 Use Test2::Plugin::Cover to collect coverage data for what files are touched by what tests. Unlike Devel::Cover this has very little performance impact (About 4% difference)
284
285
286 =item --cover-from path/to/log.jsonl
287
288 =item --cover-from http://example.com/coverage
289
290 =item --cover-from path/to/coverage.jsonl
291
292 =item --no-cover-from
293
294 This can be a test log, a coverage dump (old style json or new jsonl format), or a url to any of the previous. Tests will not be run if the file/url is invalid.
295
296
297 =item --cover-from-type json
298
299 =item --cover-from-type jsonl
300
301 =item --cover-from-type log
302
303 =item --no-cover-from-type
304
305 File type for coverage source. Usually it can be detected, but when it cannot be you should specify. "json" is old style single-blob coverage data, "jsonl" is the new by-test style, "log" is a logfile from a previous run.
306
307
308 =item --cover-manager My::Coverage::Manager
309
310 =item --no-cover-manager
311
312 Coverage 'from' manager to use when coverage data does not provide one
313
314
315 =item --cover-maybe-from path/to/log.jsonl
316
317 =item --cover-maybe-from http://example.com/coverage
318
319 =item --cover-maybe-from path/to/coverage.jsonl
320
321 =item --no-cover-maybe-from
322
323 This can be a test log, a coverage dump (old style json or new jsonl format), or a url to any of the previous. Tests will continue even if the coverage file/url is invalid.
324
325
326 =item --cover-maybe-from-type json
327
328 =item --cover-maybe-from-type jsonl
329
330 =item --cover-maybe-from-type log
331
332 =item --no-cover-maybe-from-type
333
334 Same as "from_type" but for "maybe_from". Defaults to "from_type" if that is specified, otherwise auto-detect
335
336
337 =item --cover-metrics
338
339 =item --no-cover-metrics
340
341
342
343
344 =item --cover-types ARG
345
346 =item --cover-types=ARG
347
348 =item --cover-type ARG
349
350 =item --cover-type=ARG
351
352 =item --no-cover-types
353
354 NO DESCRIPTION - FIX ME
355
356 Can be specified multiple times
357
358
359 =item --cover-write
360
361 =item --cover-write=coverage.jsonl
362
363 =item --cover-write=coverage.json
364
365 =item --no-cover-write
366
367 Create a json or jsonl file of all coverage data seen during the run (This implies --cover-files).
368
369
370 =back
371
372 =head3 Display Options
373
374 =over 4
375
376 =item --color
377
378 =item --no-color
379
380 Turn color on, default is true if STDOUT is a TTY.
381
382
383 =item --hide-runner-output
384
385 =item --no-hide-runner-output
386
387 Hide output from the runner, showing only test output. (See Also truncate_runner_output)
388
389
390 =item --no-final-table
391
392 =item --no-no-final-table
393
394 When printing final results, don't use table-style display
395
396
397 =item --no-wrap
398
399 =item --no-no-wrap
400
401 Do not do fancy text-wrapping, let the terminal handle it
402
403
404 =item --progress
405
406 =item --no-progress
407
408 Toggle progress indicators. On by default if STDOUT is a TTY. You can use --no-progress to disable the 'events seen' counter and buffered event pre-display
409
410
411 =item --quiet
412
413 =item -q
414
415 =item --no-quiet
416
417 Be very quiet.
418
419 Can be specified multiple times
420
421
422 =item --renderers +My::Renderer
423
424 =item --renderers Renderer=arg1,arg2,...
425
426 =item --renderer +My::Renderer
427
428 =item --renderer Renderer=arg1,arg2,...
429
430 =item --no-renderers
431
432 Specify renderers, (Default: "Formatter=Test2"). Use "+" to give a fully qualified module name. Without "+" "Test2::Harness::Renderer::" will be prepended to your argument.
433
434 Can be specified multiple times. If the same key is listed multiple times the value lists will be appended together.
435
436
437 =item --show-times
438
439 =item -T
440
441 =item --no-show-times
442
443 Show the timing data for each job
444
445
446 =item --term-width 80
447
448 =item --term-width 200
449
450 =item --term-size 80
451
452 =item --term-size 200
453
454 =item --no-term-width
455
456 Alternative to setting $TABLE_TERM_SIZE. Setting this will override the terminal width detection to the number of characters specified.
457
458
459 =item --truncate-runner-output
460
461 =item --no-truncate-runner-output
462
463 Only show runner output that was generated after the current command. This is only useful with a persistent runner.
464
465
466 =item --verbose
467
468 =item -v
469
470 =item --no-verbose
471
472 Be more verbose
473
474 Can be specified multiple times
475
476
477 =back
478
479 =head3 Finder Options
480
481 =over 4
482
483 =item --changed path/to/file
484
485 =item --no-changed
486
487 Specify one or more files as having been changed.
488
489 Can be specified multiple times
490
491
492 =item --changed-only
493
494 =item --no-changed-only
495
496 Only search for tests for changed files (Requires a coverage data source, also requires a list of changes either from the --changed option, or a plugin that implements changed_files() or changed_diff())
497
498
499 =item --changes-diff path/to/diff.diff
500
501 =item --no-changes-diff
502
503 Path to a diff file that should be used to find changed files for use with --changed-only. This must be in the same format as `git diff -W --minimal -U1000000`
504
505
506 =item --changes-exclude-file path/to/file
507
508 =item --no-changes-exclude-file
509
510 Specify one or more files to ignore when looking at changes
511
512 Can be specified multiple times
513
514
515 =item --changes-exclude-loads
516
517 =item --no-changes-exclude-loads
518
519 Exclude coverage tests which only load changed files, but never call code from them. (default: off)
520
521
522 =item --changes-exclude-nonsub
523
524 =item --no-changes-exclude-nonsub
525
526 Exclude changes outside of subroutines (perl files only) (default: off)
527
528
529 =item --changes-exclude-opens
530
531 =item --no-changes-exclude-opens
532
533 Exclude coverage tests which only open() changed files, but never call code from them. (default: off)
534
535
536 =item --changes-exclude-pattern '(apple|pear|orange)'
537
538 =item --no-changes-exclude-pattern
539
540 Ignore files matching this pattern when looking for changes. Your pattern will be inserted unmodified into a `$file =~ m/$pattern/` check.
541
542 Can be specified multiple times
543
544
545 =item --changes-filter-file path/to/file
546
547 =item --no-changes-filter-file
548
549 Specify one or more files to check for changes. Changes to other files will be ignored
550
551 Can be specified multiple times
552
553
554 =item --changes-filter-pattern '(apple|pear|orange)'
555
556 =item --no-changes-filter-pattern
557
558 Specify a pattern for change checking. When only running tests for changed files this will limit which files are checked for changes. Only files that match this pattern will be checked. Your pattern will be inserted unmodified into a `$file =~ m/$pattern/` check.
559
560 Can be specified multiple times
561
562
563 =item --changes-include-whitespace
564
565 =item --no-changes-include-whitespace
566
567 Include changed lines that are whitespace only (default: off)
568
569
570 =item --changes-plugin Git
571
572 =item --changes-plugin +App::Yath::Plugin::Git
573
574 =item --no-changes-plugin
575
576 What plugin should be used to detect changed files.
577
578
579 =item --default-at-search ARG
580
581 =item --default-at-search=ARG
582
583 =item --no-default-at-search
584
585 Specify the default file/dir search when 'AUTHOR_TESTING' is set. Defaults to './xt'. The default AT search is only used if no files were specified at the command line
586
587 Can be specified multiple times
588
589
590 =item --default-search ARG
591
592 =item --default-search=ARG
593
594 =item --no-default-search
595
596 Specify the default file/dir search. defaults to './t', './t2', and 'test.pl'. The default search is only used if no files were specified at the command line
597
598 Can be specified multiple times
599
600
601 =item --durations file.json
602
603 =item --durations http://example.com/durations.json
604
605 =item --no-durations
606
607 Point at a json file or url which has a hash of relative test filenames as keys, and 'SHORT', 'MEDIUM', or 'LONG' as values. This will override durations listed in the file headers. An exception will be thrown if the durations file or url does not work.
608
609
610 =item --durations-threshold ARG
611
612 =item --durations-threshold=ARG
613
614 =item --Dt ARG
615
616 =item --Dt=ARG
617
618 =item --no-durations-threshold
619
620 Only fetch duration data if running at least this number of tests. Default (-j value + 1)
621
622
623 =item --exclude-file t/nope.t
624
625 =item --no-exclude-file
626
627 Exclude a file from testing
628
629 Can be specified multiple times
630
631
632 =item --exclude-list file.txt
633
634 =item --exclude-list http://example.com/exclusions.txt
635
636 =item --no-exclude-list
637
638 Point at a file or url which has a new line separated list of test file names to exclude from testing. Starting a line with a '#' will comment it out (for compatibility with Test2::Aggregate list files).
639
640 Can be specified multiple times
641
642
643 =item --exclude-pattern t/nope.t
644
645 =item --no-exclude-pattern
646
647 Exclude a pattern from testing, matched using m/$PATTERN/
648
649 Can be specified multiple times
650
651
652 =item --extension ARG
653
654 =item --extension=ARG
655
656 =item --ext ARG
657
658 =item --ext=ARG
659
660 =item --no-extension
661
662 Specify valid test filename extensions, default: t and t2
663
664 Can be specified multiple times
665
666
667 =item --maybe-durations file.json
668
669 =item --maybe-durations http://example.com/durations.json
670
671 =item --no-maybe-durations
672
673 Point at a json file or url which has a hash of relative test filenames as keys, and 'SHORT', 'MEDIUM', or 'LONG' as values. This will override durations listed in the file headers. An exception will be thrown if the durations file or url does not work.
674
675
676 =item --no-long
677
678 =item --no-no-long
679
680 Do not run tests that have their duration flag set to 'LONG'
681
682
683 =item --only-long
684
685 =item --no-only-long
686
687 Only run tests that have their duration flag set to 'LONG'
688
689
690 =item --rerun
691
692 =item --rerun=path/to/log.jsonl
693
694 =item --rerun=plugin_specific_string
695
696 =item --no-rerun
697
698 Re-Run tests from a previous run from a log file (or last log file). Plugins can intercept this, such as YathUIDB which will grab a run UUID and derive tests to re-run from that.
699
700
701 =item --rerun-all
702
703 =item --rerun-all=path/to/log.jsonl
704
705 =item --rerun-all=plugin_specific_string
706
707 =item --no-rerun-all
708
709 Re-Run all tests from a previous run from a log file (or last log file). Plugins can intercept this, such as YathUIDB which will grab a run UUID and derive tests to re-run from that.
710
711
712 =item --rerun-failed
713
714 =item --rerun-failed=path/to/log.jsonl
715
716 =item --rerun-failed=plugin_specific_string
717
718 =item --no-rerun-failed
719
720 Re-Run failed tests from a previous run from a log file (or last log file). Plugins can intercept this, such as YathUIDB which will grab a run UUID and derive tests to re-run from that.
721
722
723 =item --rerun-missed
724
725 =item --rerun-missed=path/to/log.jsonl
726
727 =item --rerun-missed=plugin_specific_string
728
729 =item --no-rerun-missed
730
731 Run missed tests from a previously aborted/stopped run from a log file (or last log file). Plugins can intercept this, such as YathUIDB which will grab a run UUID and derive tests to re-run from that.
732
733
734 =item --rerun-modes failed,missed,...
735
736 =item --rerun-modes all
737
738 =item --rerun-modes failed
739
740 =item --rerun-modes missed
741
742 =item --rerun-modes passed
743
744 =item --rerun-modes retried
745
746 =item --rerun-mode failed,missed,...
747
748 =item --rerun-mode all
749
750 =item --rerun-mode failed
751
752 =item --rerun-mode missed
753
754 =item --rerun-mode passed
755
756 =item --rerun-mode retried
757
758 =item --no-rerun-modes
759
760 Pick which test categories to run
761
762 Can be specified multiple times
763
764
765 =item --rerun-passed
766
767 =item --rerun-passed=path/to/log.jsonl
768
769 =item --rerun-passed=plugin_specific_string
770
771 =item --no-rerun-passed
772
773 Re-Run passed tests from a previous run from a log file (or last log file). Plugins can intercept this, such as YathUIDB which will grab a run UUID and derive tests to re-run from that.
774
775
776 =item --rerun-plugin Foo
777
778 =item --rerun-plugin +App::Yath::Plugin::Foo
779
780 =item --no-rerun-plugin
781
782 What plugin(s) should be used for rerun (will fallback to other plugins if the listed ones decline the value, this is just used to set an order of priority)
783
784 Can be specified multiple times
785
786
787 =item --rerun-retried
788
789 =item --rerun-retried=path/to/log.jsonl
790
791 =item --rerun-retried=plugin_specific_string
792
793 =item --no-rerun-retried
794
795 Re-Run retried tests from a previous run from a log file (or last log file). Plugins can intercept this, such as YathUIDB which will grab a run UUID and derive tests to re-run from that.
796
797
798 =item --search ARG
799
800 =item --search=ARG
801
802 =item --no-search
803
804 List of tests and test directories to use instead of the default search paths. Typically these can simply be listed as command line arguments without the --search prefix.
805
806 Can be specified multiple times
807
808
809 =item --show-changed-files
810
811 =item --no-show-changed-files
812
813 Print a list of changed files if any are found
814
815
816 =back
817
818 =head3 Formatter Options
819
820 =over 4
821
822 =item --formatter ARG
823
824 =item --formatter=ARG
825
826 =item --no-formatter
827
828 NO DESCRIPTION - FIX ME
829
830
831 =item --qvf
832
833 =item --no-qvf
834
835 [Q]uiet, but [V]erbose on [F]ailure. Hide all output from tests when they pass, except to say they passed. If a test fails then ALL output from the test is verbosely output.
836
837
838 =item --show-job-end
839
840 =item --no-show-job-end
841
842 Show output when a job ends. (Default: on)
843
844
845 =item --show-job-info
846
847 =item --no-show-job-info
848
849 Show the job configuration when a job starts. (Default: off, unless -vv)
850
851
852 =item --show-job-launch
853
854 =item --no-show-job-launch
855
856 Show output for the start of a job. (Default: off unless -v)
857
858
859 =item --show-run-info
860
861 =item --no-show-run-info
862
863 Show the run configuration when a run starts. (Default: off, unless -vv)
864
865
866 =back
867
868 =head3 Git Options
869
870 =over 4
871
872 =item --git-change-base master
873
874 =item --git-change-base HEAD^
875
876 =item --git-change-base df22abe4
877
878 =item --no-git-change-base
879
880 Find files changed by all commits in the current branch from most recent stopping when a commit is found that is also present in the history of the branch/commit specified as the change base.
881
882
883 =back
884
885 =head3 Help and Debugging
886
887 =over 4
888
889 =item --dummy
890
891 =item -d
892
893 =item --no-dummy
894
895 Dummy run, do not actually execute anything
896
897 Can also be set with the following environment variables: C<T2_HARNESS_DUMMY>
898
899
900 =item --help
901
902 =item -h
903
904 =item --no-help
905
906 exit after showing help information
907
908
909 =item --interactive
910
911 =item -i
912
913 =item --no-interactive
914
915 Use interactive mode, 1 test at a time, stdin forwarded to it
916
917
918 =item --keep-dirs
919
920 =item --keep_dir
921
922 =item -k
923
924 =item --no-keep-dirs
925
926 Do not delete directories when done. This is useful if you want to inspect the directories used for various commands.
927
928
929 =item --procname-prefix ARG
930
931 =item --procname-prefix=ARG
932
933 =item --no-procname-prefix
934
935 Add a prefix to all proc names (as seen by ps).
936
937
938 =item --summary
939
940 =item --summary=/path/to/summary.json
941
942 =item --no-summary
943
944 Write out a summary json file, if no path is provided 'summary.json' will be used. The .json extension is added automatically if omitted.
945
946
947 =back
948
949 =head3 Logging Options
950
951 =over 4
952
953 =item --bzip2
954
955 =item --bz2
956
957 =item --bzip2_log
958
959 =item -B
960
961 =item --no-bzip2
962
963 Use bzip2 compression when writing the log. This option implies -L. The .bz2 prefix is added to log file name for you
964
965
966 =item --gzip
967
968 =item --gz
969
970 =item --gzip_log
971
972 =item -G
973
974 =item --no-gzip
975
976 Use gzip compression when writing the log. This option implies -L. The .gz prefix is added to log file name for you
977
978
979 =item --log
980
981 =item -L
982
983 =item --no-log
984
985 Turn on logging
986
987
988 =item --log-dir ARG
989
990 =item --log-dir=ARG
991
992 =item --no-log-dir
993
994 Specify a log directory. Will fall back to the system temp dir.
995
996
997 =item --log-file ARG
998
999 =item --log-file=ARG
1000
1001 =item -F ARG
1002
1003 =item -F=ARG
1004
1005 =item --no-log-file
1006
1007 Specify the name of the log file. This option implies -L.
1008
1009
1010 =item --log-file-format ARG
1011
1012 =item --log-file-format=ARG
1013
1014 =item --lff ARG
1015
1016 =item --lff=ARG
1017
1018 =item --no-log-file-format
1019
1020 Specify the format for automatically-generated log files. Overridden by --log-file, if given. This option implies -L (Default: \$YATH_LOG_FILE_FORMAT, if that is set, or else "%!P%Y-%m-%d~%H:%M:%S~%!U~%!p.jsonl"). This is a string in which percent-escape sequences will be replaced as per POSIX::strftime. The following special escape sequences are also replaced: (%!P : Project name followed by a ~, if a project is defined, otherwise empty string) (%!U : the unique test run ID) (%!p : the process ID) (%!S : the number of seconds since local midnight UTC)
1021
1022 Can also be set with the following environment variables: C<YATH_LOG_FILE_FORMAT>, C<TEST2_HARNESS_LOG_FORMAT>
1023
1024
1025 =back
1026
1027 =head3 Notification Options
1028
1029 =over 4
1030
1031 =item --notify-email [email protected]
1032
1033 =item --no-notify-email
1034
1035 Email the test results to the specified email address(es)
1036
1037 Can be specified multiple times
1038
1039
1040 =item --notify-email-fail [email protected]
1041
1042 =item --no-notify-email-fail
1043
1044 Email failing results to the specified email address(es)
1045
1046 Can be specified multiple times
1047
1048
1049 =item --notify-email-from [email protected]
1050
1051 =item --no-notify-email-from
1052
1053 If any email is sent, this is who it will be from
1054
1055
1056 =item --notify-email-owner
1057
1058 =item --no-notify-email-owner
1059
1060 Email the owner of broken tests files upon failure. Add `# HARNESS-META-OWNER [email protected]` to the top of a test file to give it an owner
1061
1062
1063 =item --notify-no-batch-email
1064
1065 =item --no-notify-no-batch-email
1066
1067 Usually owner failures are sent as a single batch at the end of testing. Toggle this to send failures as they happen.
1068
1069
1070 =item --notify-no-batch-slack
1071
1072 =item --no-notify-no-batch-slack
1073
1074 Usually owner failures are sent as a single batch at the end of testing. Toggle this to send failures as they happen.
1075
1076
1077 =item --notify-slack '#foo'
1078
1079 =item --notify-slack '@bar'
1080
1081 =item --no-notify-slack
1082
1083 Send results to a slack channel and/or user
1084
1085 Can be specified multiple times
1086
1087
1088 =item --notify-slack-fail '#foo'
1089
1090 =item --notify-slack-fail '@bar'
1091
1092 =item --no-notify-slack-fail
1093
1094 Send failing results to a slack channel and/or user
1095
1096 Can be specified multiple times
1097
1098
1099 =item --notify-slack-owner
1100
1101 =item --no-notify-slack-owner
1102
1103 Send slack notifications to the slack channels/users listed in test meta-data when tests fail.
1104
1105
1106 =item --notify-slack-url https://hooks.slack.com/...
1107
1108 =item --no-notify-slack-url
1109
1110 Specify an API endpoint for slack webhook integrations
1111
1112
1113 =item --notify-text ARG
1114
1115 =item --notify-text=ARG
1116
1117 =item --message ARG
1118
1119 =item --message=ARG
1120
1121 =item --msg ARG
1122
1123 =item --msg=ARG
1124
1125 =item --no-notify-text
1126
1127 Add a custom text snippet to email/slack notifications
1128
1129
1130 =item --notify-text-module ARG
1131
1132 =item --notify-text-module=ARG
1133
1134 =item --message_module ARG
1135
1136 =item --message_module=ARG
1137
1138 =item --no-notify-text-module
1139
1140 Use the specified module to generate messages for emails and/or slack.
1141
1142
1143 =back
1144
1145 =head3 Run Options
1146
1147 =over 4
1148
1149 =item --author-testing
1150
1151 =item -A
1152
1153 =item --no-author-testing
1154
1155 This will set the AUTHOR_TESTING environment to true
1156
1157
1158 =item --dbi-profiling
1159
1160 =item --no-dbi-profiling
1161
1162 Use Test2::Plugin::DBIProfile to collect database profiling data
1163
1164
1165 =item --env-var VAR=VAL
1166
1167 =item -EVAR=VAL
1168
1169 =item -E VAR=VAL
1170
1171 =item --no-env-var
1172
1173 Set environment variables to set when each test is run.
1174
1175 Can be specified multiple times
1176
1177
1178 =item --event-uuids
1179
1180 =item --uuids
1181
1182 =item --no-event-uuids
1183
1184 Use Test2::Plugin::UUID inside tests (default: on)
1185
1186
1187 =item --fields name:details
1188
1189 =item --fields JSON_STRING
1190
1191 =item -f name:details
1192
1193 =item -f JSON_STRING
1194
1195 =item --no-fields
1196
1197 Add custom data to the harness run
1198
1199 Can be specified multiple times
1200
1201
1202 =item --input ARG
1203
1204 =item --input=ARG
1205
1206 =item --no-input
1207
1208 Input string to be used as standard input for ALL tests. See also: --input-file
1209
1210
1211 =item --input-file ARG
1212
1213 =item --input-file=ARG
1214
1215 =item --no-input-file
1216
1217 Use the specified file as standard input to ALL tests
1218
1219
1220 =item --io-events
1221
1222 =item --no-io-events
1223
1224 Use Test2::Plugin::IOEvents inside tests to turn all prints into test2 events (default: off)
1225
1226
1227 =item --link 'https://travis.work/builds/42'
1228
1229 =item --link 'https://jenkins.work/job/42'
1230
1231 =item --link 'https://buildbot.work/builders/foo/builds/42'
1232
1233 =item --no-link
1234
1235 Provide one or more links people can follow to see more about this run.
1236
1237 Can be specified multiple times
1238
1239
1240 =item --load ARG
1241
1242 =item --load=ARG
1243
1244 =item --load-module ARG
1245
1246 =item --load-module=ARG
1247
1248 =item -m ARG
1249
1250 =item -m=ARG
1251
1252 =item --no-load
1253
1254 Load a module in each test (after fork). The "import" method is not called.
1255
1256 Can be specified multiple times
1257
1258
1259 =item --load-import Module
1260
1261 =item --load-import Module=import_arg1,arg2,...
1262
1263 =item --loadim Module
1264
1265 =item --loadim Module=import_arg1,arg2,...
1266
1267 =item -M Module
1268
1269 =item -M Module=import_arg1,arg2,...
1270
1271 =item --no-load-import
1272
1273 Load a module in each test (after fork). Import is called.
1274
1275 Can be specified multiple times. If the same key is listed multiple times the value lists will be appended together.
1276
1277
1278 =item --mem-usage
1279
1280 =item --no-mem-usage
1281
1282 Use Test2::Plugin::MemUsage inside tests (default: on)
1283
1284
1285 =item --retry ARG
1286
1287 =item --retry=ARG
1288
1289 =item -r ARG
1290
1291 =item -r=ARG
1292
1293 =item --no-retry
1294
1295 Run any jobs that failed a second time. NOTE: --retry=1 means failing tests will be attempted twice!
1296
1297
1298 =item --retry-isolated
1299
1300 =item --retry-iso
1301
1302 =item --no-retry-isolated
1303
1304 If true then any job retries will be done in isolation (as though -j1 was set)
1305
1306
1307 =item --run-id
1308
1309 =item --id
1310
1311 =item --no-run-id
1312
1313 Set a specific run-id. (Default: a UUID)
1314
1315
1316 =item --test-args ARG
1317
1318 =item --test-args=ARG
1319
1320 =item --no-test-args
1321
1322 Arguments to pass in as @ARGV for all tests that are run. These can be provided easier using the '::' argument separator.
1323
1324 Can be specified multiple times
1325
1326
1327 =item --stream
1328
1329 =item --no-stream
1330
1331 Use the stream formatter (default is on)
1332
1333
1334 =item --tap
1335
1336 =item --TAP
1337
1338 =item ----no-stream
1339
1340 =item --no-tap
1341
1342 The TAP format is lossy and clunky. Test2::Harness normally uses a newer streaming format to receive test results. There are old/legacy tests where this causes problems, in which case setting --TAP or --no-stream can help.
1343
1344
1345 =back
1346
1347 =head3 YathUI Options
1348
1349 =over 4
1350
1351 =item --yathui-api-key ARG
1352
1353 =item --yathui-api-key=ARG
1354
1355 =item --no-yathui-api-key
1356
1357 Yath-UI API key. This is not necessary if your Yath-UI instance is set to single-user
1358
1359
1360 =item --yathui-coverage
1361
1362 =item --no-yathui-coverage
1363
1364 Poll coverage data from Yath-UI to determine what tests should be run for changed files
1365
1366
1367 =item --yathui-durations
1368
1369 =item --no-yathui-durations
1370
1371 Poll duration data from Yath-UI to help order tests efficiently
1372
1373
1374 =item --yathui-grace
1375
1376 =item --no-yathui-grace
1377
1378 If yath cannot connect to yath-ui it normally throws an error, use this to make it fail gracefully. You get a warning, but things keep going.
1379
1380
1381 =item --yathui-long-duration 10
1382
1383 =item --no-yathui-long-duration
1384
1385 Minimum duration length (seconds) before a test goes from MEDIUM to LONG
1386
1387
1388 =item --yathui-medium-duration 5
1389
1390 =item --no-yathui-medium-duration
1391
1392 Minimum duration length (seconds) before a test goes from SHORT to MEDIUM
1393
1394
1395 =item --yathui-mode summary
1396
1397 =item --yathui-mode qvf
1398
1399 =item --yathui-mode qvfd
1400
1401 =item --yathui-mode complete
1402
1403 =item --no-yathui-mode
1404
1405 Set the upload mode (default 'qvfd')
1406
1407
1408 =item --yathui-project ARG
1409
1410 =item --yathui-project=ARG
1411
1412 =item --no-yathui-project
1413
1414 The Yath-UI project for your test results
1415
1416
1417 =item --yathui-retry
1418
1419 =item --no-yathui-retry
1420
1421 How many times to try an operation before giving up
1422
1423 Can be specified multiple times
1424
1425
1426 =item --yathui-upload
1427
1428 =item --no-yathui-upload
1429
1430 Upload the log to Yath-UI
1431
1432
1433 =item --yathui-url http://my-yath-ui.com/...
1434
1435 =item --uri http://my-yath-ui.com/...
1436
1437 =item --no-yathui-url
1438
1439 Yath-UI url
1440
1441
1442 =back
1443
1444 =head3 NO CATEGORY - FIX ME
1445
1446 =over 4
1447
1448 =item --check-reload-state
1449
1450 =item --no-check-reload-state
1451
1452 Abort the run if there are unfixes reload errors and show a confirmation dialogue for unfixed reload warnings.
1453
1454
1455 =back
1456
1457 =head1 SOURCE
1458
1459 The source code repository for Test2-Harness can be found at
1460 F<http://github.com/Test-More/Test2-Harness/>.
1461
1462 =head1 MAINTAINERS
1463
1464 =over 4
1465
1466 =item Chad Granum E<lt>[email protected]<gt>
1467
1468 =back
1469
1470 =head1 AUTHORS
1471
1472 =over 4
1473
1474 =item Chad Granum E<lt>[email protected]<gt>
1475
1476 =back
1477
1478 =head1 COPYRIGHT
1479
1480 Copyright 2026 Chad Granum E<lt>[email protected]<gt>.
1481
1482 This program is free software; you can redistribute it and/or
1483 modify it under the same terms as Perl itself.
1484
1485 See F<http://dev.perl.org/licenses/>
1486
1487 =cut
1488