when running `garden test` to test run all tests f...
# 🤖|ask-kapa
b
@microscopic-river-74022 when running
garden test
to test run all tests found in all modules, if some of them fail, the command exits with
exit code 0
how can i run all the tests and fail if any test fails?
m
Please stand by @bland-wolf-59979 as I search the knowledge base. I normally take about 20 seconds or so. :wave:
---------------------- When you run the
garden test
command, it will execute all or specified tests defined in your project. If any of the tests fail, the command should not exit with
exit code 0
. An exit code of
0
typically indicates that the command was successful, while any non-zero exit code indicates an error or failure. In the Garden test results, each test that was executed will have an
exitCode
field. If the test was successful, the
exitCode
should be
0
. If the test failed, the
exitCode
should be non-zero. This is how you can determine if any tests failed when running the
garden test
command. Here is an example of what the test results might look like:
Copy code
yaml
test:
  <Test name>:
    success: false
    exitCode: 1
    startedAt: <timestamp>
    completedAt: <timestamp>
    log: <log output>
In this example, the test named
<Test name>
failed because the
success
field is
false
and the
exitCode
is
1
. If you want the
garden test
command to fail if any test fails, you should check the exit code of the command. If the exit code is non-zero, that means at least one test failed. Sources: - Garden Test Command () - Garden Test Outputs () ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
message has been deleted
2 Views