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`.
This commit is contained in:
amtoine 2023-03-19 10:15:02 +01:00
parent 64f50a179e
commit ec85b6fd3f
No known key found for this signature in database
GPG Key ID: 37AAE9B486CFF1AB

View File

@ -15,7 +15,14 @@ def main [] {
for test_case in $tests {
log debug $"Run test ($module_name) ($test_case)"
nu -c $'use ($test_file) ($test_case); ($test_case)'
try {
nu -c $'use ($test_file) ($test_case); ($test_case)'
} catch { error make {
msg: $"(ansi red)std::tests::test_failed(ansi reset)"
label: {
text: $"($module_name)::($test_case) failed."
}
}}
}
}
}