In his talk, Nuno Maduro announced Pest v3, with several new features and no breaking changes.
I know this is pretty exciting to a lot of people, but personally I prefer PHPUnit for several reasons:
- Better IDE support
- e.g., in a Pest test,
$this->assertDatabaseHas(…)
runs without errors, but the IDE thinks it’s invalid because the test file doesn’t extend the baseTestCase
or inherit any of the parent methods - I personally like the discoverability of using a class, as my IDE will suggest available methods.
- I do think there are some Pest helpers that I haven’t fully used, so those might help alleviate these gripes.
- Yes, I know that Pest can be used as the test runner, and still use PHPUnit-style classes.
- e.g., in a Pest test,
- Improved VS Code test integration
- This is the best VS Code extension I’ve found to work with tests in a PHP project. It shows all the tests along with pass/fail results in the sidebar, and I use the keyboard shortcut to run tests all the time.
- The extension only works with PHPUnit tests, not Pest.
- However, the upcoming first-party Laravel VS Code extension might change that…
These new features did catch my eye though:
- Architecture presets: ensure your code follows best practices and conventions; read more here and see the plugin here
- Mutation testing: let Pest modify parts of your code to ensure it causes failing tests, to ensure your tests are covering what you think they are; see the plugin here
I’ll be taking a look to see if I can use some of the underlying packages with PHPUnit.
All in all, seems like a solid upgrade, but it just doesn’t excite me all that much.