Debian Codegraph @

lib/App/Yath/Command/which.pm

raw
1 package App::Yath::Command::which;
2 use strict;
3 use warnings;
4
5 our $VERSION = '1.000179';
6
7 use App::Yath::Util qw/find_pfile/;
8
9 use Test2::Harness::Util::File::JSON;
10
11 use parent 'App::Yath::Command';
12 use Test2::Harness::Util::HashBase;
13
14 sub group { 'persist' }
15
16 sub summary { "Locate the persistent test runner" }
17 sub cli_args { "" }
18
19 sub description {
20 return <<" EOT";
21 This will tell you about any persistent runners it can find.
22 EOT
23 }
24
25 sub run {
26 my $self = shift;
27
28 my $pfile = find_pfile($self->settings, no_fatal => 1);
29
30 unless ($pfile) {
31 print "\nNo persistent harness was found for the current path.\n\n";
32 return 0;
33 }
34
35 print "\nFound: $pfile\n";
36 my $data = Test2::Harness::Util::File::JSON->new(name => $pfile)->read();
37 print " PID: $data->{pid}\n";
38 print " Dir: $data->{dir}\n";
39 print "\n";
40
41 return 0;
42 }
43
44 1;
45
46 __END__
47
48 =pod
49
50 =encoding UTF-8
51
52 =head1 NAME
53
54 App::Yath::Command::which - Locate the persistent test runner
55
56 =head1 DESCRIPTION
57
58 This will tell you about any persistent runners it can find.
59
60
61 =head1 USAGE
62
63 $ yath [YATH OPTIONS] which [COMMAND OPTIONS]
64
65 =head2 YATH OPTIONS
66
67 =head3 Developer
68
69 =over 4
70
71 =item --dev-lib
72
73 =item --dev-lib=lib
74
75 =item -D
76
77 =item -D=lib
78
79 =item -Dlib
80
81 =item --no-dev-lib
82
83 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.
84
85 Can be specified multiple times
86
87
88 =back
89
90 =head3 Environment
91
92 =over 4
93
94 =item --persist-dir ARG
95
96 =item --persist-dir=ARG
97
98 =item --no-persist-dir
99
100 Where to find persistence files.
101
102
103 =item --persist-file ARG
104
105 =item --persist-file=ARG
106
107 =item --pfile ARG
108
109 =item --pfile=ARG
110
111 =item --no-persist-file
112
113 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.
114
115
116 =item --project ARG
117
118 =item --project=ARG
119
120 =item --project-name ARG
121
122 =item --project-name=ARG
123
124 =item --no-project
125
126 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.
127
128
129 =back
130
131 =head3 Help and Debugging
132
133 =over 4
134
135 =item --show-opts
136
137 =item --no-show-opts
138
139 Exit after showing what yath thinks your options mean
140
141
142 =item --version
143
144 =item -V
145
146 =item --no-version
147
148 Exit after showing a helpful usage message
149
150
151 =back
152
153 =head3 Plugins
154
155 =over 4
156
157 =item --no-scan-plugins
158
159 =item --no-no-scan-plugins
160
161 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.
162
163
164 =item --plugins PLUGIN
165
166 =item --plugins +App::Yath::Plugin::PLUGIN
167
168 =item --plugins PLUGIN=arg1,arg2,...
169
170 =item --plugin PLUGIN
171
172 =item --plugin +App::Yath::Plugin::PLUGIN
173
174 =item --plugin PLUGIN=arg1,arg2,...
175
176 =item -pPLUGIN
177
178 =item --no-plugins
179
180 Load a yath plugin.
181
182 Can be specified multiple times
183
184
185 =back
186
187 =head2 COMMAND OPTIONS
188
189 =head3 Cover Options
190
191 =over 4
192
193 =item --cover-aggregator ByTest
194
195 =item --cover-aggregator ByRun
196
197 =item --cover-aggregator +Custom::Aggregator
198
199 =item --cover-agg ByTest
200
201 =item --cover-agg ByRun
202
203 =item --cover-agg +Custom::Aggregator
204
205 =item --no-cover-aggregator
206
207 Choose a custom aggregator subclass
208
209
210 =item --cover-class ARG
211
212 =item --cover-class=ARG
213
214 =item --no-cover-class
215
216 Choose a Test2::Plugin::Cover subclass
217
218
219 =item --cover-dirs ARG
220
221 =item --cover-dirs=ARG
222
223 =item --cover-dir ARG
224
225 =item --cover-dir=ARG
226
227 =item --no-cover-dirs
228
229 NO DESCRIPTION - FIX ME
230
231 Can be specified multiple times
232
233
234 =item --cover-exclude-dirs ARG
235
236 =item --cover-exclude-dirs=ARG
237
238 =item --cover-exclude-dir ARG
239
240 =item --cover-exclude-dir=ARG
241
242 =item --no-cover-exclude-dirs
243
244 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.
245
246 Can be specified multiple times
247
248
249 =item --cover-exclude-private
250
251 =item --no-cover-exclude-private
252
253
254
255
256 =item --cover-files
257
258 =item --no-cover-files
259
260 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)
261
262
263 =item --cover-from path/to/log.jsonl
264
265 =item --cover-from http://example.com/coverage
266
267 =item --cover-from path/to/coverage.jsonl
268
269 =item --no-cover-from
270
271 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.
272
273
274 =item --cover-from-type json
275
276 =item --cover-from-type jsonl
277
278 =item --cover-from-type log
279
280 =item --no-cover-from-type
281
282 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.
283
284
285 =item --cover-manager My::Coverage::Manager
286
287 =item --no-cover-manager
288
289 Coverage 'from' manager to use when coverage data does not provide one
290
291
292 =item --cover-maybe-from path/to/log.jsonl
293
294 =item --cover-maybe-from http://example.com/coverage
295
296 =item --cover-maybe-from path/to/coverage.jsonl
297
298 =item --no-cover-maybe-from
299
300 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.
301
302
303 =item --cover-maybe-from-type json
304
305 =item --cover-maybe-from-type jsonl
306
307 =item --cover-maybe-from-type log
308
309 =item --no-cover-maybe-from-type
310
311 Same as "from_type" but for "maybe_from". Defaults to "from_type" if that is specified, otherwise auto-detect
312
313
314 =item --cover-metrics
315
316 =item --no-cover-metrics
317
318
319
320
321 =item --cover-types ARG
322
323 =item --cover-types=ARG
324
325 =item --cover-type ARG
326
327 =item --cover-type=ARG
328
329 =item --no-cover-types
330
331 NO DESCRIPTION - FIX ME
332
333 Can be specified multiple times
334
335
336 =item --cover-write
337
338 =item --cover-write=coverage.jsonl
339
340 =item --cover-write=coverage.json
341
342 =item --no-cover-write
343
344 Create a json or jsonl file of all coverage data seen during the run (This implies --cover-files).
345
346
347 =back
348
349 =head3 Git Options
350
351 =over 4
352
353 =item --git-change-base master
354
355 =item --git-change-base HEAD^
356
357 =item --git-change-base df22abe4
358
359 =item --no-git-change-base
360
361 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.
362
363
364 =back
365
366 =head3 Help and Debugging
367
368 =over 4
369
370 =item --dummy
371
372 =item -d
373
374 =item --no-dummy
375
376 Dummy run, do not actually execute anything
377
378 Can also be set with the following environment variables: C<T2_HARNESS_DUMMY>
379
380
381 =item --help
382
383 =item -h
384
385 =item --no-help
386
387 exit after showing help information
388
389
390 =item --interactive
391
392 =item -i
393
394 =item --no-interactive
395
396 Use interactive mode, 1 test at a time, stdin forwarded to it
397
398
399 =item --keep-dirs
400
401 =item --keep_dir
402
403 =item -k
404
405 =item --no-keep-dirs
406
407 Do not delete directories when done. This is useful if you want to inspect the directories used for various commands.
408
409
410 =item --procname-prefix ARG
411
412 =item --procname-prefix=ARG
413
414 =item --no-procname-prefix
415
416 Add a prefix to all proc names (as seen by ps).
417
418
419 =back
420
421 =head3 YathUI Options
422
423 =over 4
424
425 =item --yathui-api-key ARG
426
427 =item --yathui-api-key=ARG
428
429 =item --no-yathui-api-key
430
431 Yath-UI API key. This is not necessary if your Yath-UI instance is set to single-user
432
433
434 =item --yathui-grace
435
436 =item --no-yathui-grace
437
438 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.
439
440
441 =item --yathui-long-duration 10
442
443 =item --no-yathui-long-duration
444
445 Minimum duration length (seconds) before a test goes from MEDIUM to LONG
446
447
448 =item --yathui-medium-duration 5
449
450 =item --no-yathui-medium-duration
451
452 Minimum duration length (seconds) before a test goes from SHORT to MEDIUM
453
454
455 =item --yathui-mode summary
456
457 =item --yathui-mode qvf
458
459 =item --yathui-mode qvfd
460
461 =item --yathui-mode complete
462
463 =item --no-yathui-mode
464
465 Set the upload mode (default 'qvfd')
466
467
468 =item --yathui-project ARG
469
470 =item --yathui-project=ARG
471
472 =item --no-yathui-project
473
474 The Yath-UI project for your test results
475
476
477 =item --yathui-retry
478
479 =item --no-yathui-retry
480
481 How many times to try an operation before giving up
482
483 Can be specified multiple times
484
485
486 =item --yathui-url http://my-yath-ui.com/...
487
488 =item --uri http://my-yath-ui.com/...
489
490 =item --no-yathui-url
491
492 Yath-UI url
493
494
495 =back
496
497 =head1 SOURCE
498
499 The source code repository for Test2-Harness can be found at
500 F<http://github.com/Test-More/Test2-Harness/>.
501
502 =head1 MAINTAINERS
503
504 =over 4
505
506 =item Chad Granum E<lt>[email protected]<gt>
507
508 =back
509
510 =head1 AUTHORS
511
512 =over 4
513
514 =item Chad Granum E<lt>[email protected]<gt>
515
516 =back
517
518 =head1 COPYRIGHT
519
520 Copyright 2026 Chad Granum E<lt>[email protected]<gt>.
521
522 This program is free software; you can redistribute it and/or
523 modify it under the same terms as Perl itself.
524
525 See F<http://dev.perl.org/licenses/>
526
527 =cut
528