Debian Codegraph @

lib/App/Yath/Command/kill.pm

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