# \`exit()\` may silently break your parallel tests

DevFeed: [\`exit()\` may silently break your parallel tests](<https://devfeed.tech/articles/exit-may-silently-break-your-parallel-tests-33291.md>)

Original publisher: [Read original article](<https://freek.dev/3177-exit-may-silently-break-your-parallel-tests>)

Author: Freek Van der Herten (freek@spatie.be)

Published: 2026-08-12T10:30:31Z

Content type: tutorial

Language: en

Sources: [freek.dev - all blogposts](<https://devfeed.tech/sources/freek-dev-all-blogposts.md>)

Topics: [PHPUnit](<https://devfeed.tech/topics/phpunit.md>), [Exception](<https://devfeed.tech/topics/exception.md>), [Processes](<https://devfeed.tech/topics/processes.md>)

Tags: [best-practices](<https://devfeed.tech/tags/best-practices.md>), [crash](<https://devfeed.tech/tags/crash.md>), [diagnostics](<https://devfeed.tech/tags/diagnostics.md>), [exception](<https://devfeed.tech/tags/exception.md>), [parallel](<https://devfeed.tech/tags/parallel.md>), [php](<https://devfeed.tech/tags/php.md>), [phpunit](<https://devfeed.tech/tags/phpunit.md>), [process](<https://devfeed.tech/tags/process.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tests](<https://devfeed.tech/tags/tests.md>)

## AI overview

The article explains that calling exit() can cause parallel PHPUnit test workers to crash without useful diagnostics because the process ends outside PHPUnit's control. It recommends throwing an exception instead so the failure is reported with a stack trace.

## Source excerpt

Michael explains why exit() can make parallel test workers crash without useful diagnostics, and why verbose flags do not help when the process dies outside PHPUnit's control. The fix is simple: throw an exception instead, so the failure is reported normally with a stack trace. Read more