21 / 22 lines covered (95.5%)
1unit module BDD::Behave::Watch;23use BDD::Behave::Watch::Watcher;4use BDD::Behave::Watch::SmartSelector;5use BDD::Behave::Watch::UI;6use BDD::Behave::Watch::Session;78our sub default-paths(IO::Path :$base = $*CWD --> List) {9 my @paths;10 for <lib specs> -> $name {11 my $p = $base.add($name);12 @paths.push: $p if $p.e;13 }14 @paths.List;15}1617our sub default-watcher(@paths --> BDD::Behave::Watch::Watcher::Watcher) {18 my $w = BDD::Behave::Watch::Watcher::Watcher.new;19 $w.add-path($_) for @paths;20 $w;21}2223our sub default-selector(IO::Path :$lib-root --> BDD::Behave::Watch::SmartSelector::Selector) {24 BDD::Behave::Watch::SmartSelector::Selector.new(:$lib-root);25}2627our sub make-subprocess-runner(28 :@base-argv!,29 IO::Path :$cwd,30 IO::Path :$failures-path,31 Bool :$enable-color = True,32 --> Callable33) {34 return -> $req {35 my @argv = @base-argv;36 if $req.only-failures {37 @argv.push: '--only-failures';38 @argv.push: '--failures-path', $failures-path.absolute39 if $failures-path.defined;40 }41 for $req.specs.list -> $spec {42 @argv.push: $spec.absolute;43 }44 my %env = |%*ENV;45 %env<BEHAVE_DISABLE_CONFIG> = '1' if %env<BEHAVE_DISABLE_CONFIG>:!exists;46 my @args = @argv[1..*];47 my $proc;48 if $cwd.defined {49 $proc = run(@argv[0], |@args, :env(%env), :cwd($cwd.absolute));50 } else {51 $proc = run(@argv[0], |@args, :env(%env));52 }53 $proc.exitcode;54 };55}