Skip to content

Commit ec85b6f

Browse files
committed
catch any test error and throw an error
this allows the test runner to stop whenever there is a failing test and throw an `$env.LAST_EXIT_CODE` to `1`.
1 parent 64f50a1 commit ec85b6f

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

  • crates/nu-utils/standard_library

crates/nu-utils/standard_library/tests.nu

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ def main [] {
1515

1616
for test_case in $tests {
1717
log debug $"Run test ($module_name) ($test_case)"
18-
nu -c $'use ($test_file) ($test_case); ($test_case)'
18+
try {
19+
nu -c $'use ($test_file) ($test_case); ($test_case)'
20+
} catch { error make {
21+
msg: $"(ansi red)std::tests::test_failed(ansi reset)"
22+
label: {
23+
text: $"($module_name)::($test_case) failed."
24+
}
25+
}}
1926
}
2027
}
2128
}

0 commit comments

Comments
 (0)