stdlib: Add back recursive lookup for tests (#8632)

@amtoine during the refactor the test runner lost the ability for
looking up for test modules in subdirectories. I just added it back now.
This commit is contained in:
Máté FARKAS 2023-03-28 20:17:46 +02:00 committed by GitHub
parent 8b185a4008
commit d391e912ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,10 +40,10 @@ def main [
--command: string, # Test command to run. Default: all test command found in the files.
--list, # list the selected tests without running them.
] {
let module_search_pattern = ({
let module_search_pattern = ('**' | path join ({
stem: ($module | default "test_*")
extension: nu
} | path join)
} | path join))
if not ($path | is-empty) {
if not ($path | path exists) {
@ -58,7 +58,7 @@ def main [
let path = ($path | default $env.FILE_PWD)
if not ($module | is-empty) {
if not ($path | path join $module_search_pattern | path exists) {
try { ls ($path | path join $module_search_pattern) | null } catch {
throw-error {
msg: "module_not_found"
label: $"no such module in ($path)"