This extension provides keyboard shortcuts to run Artisan Test commands in Visual Studio Code. It is especially useful for developers working with Laravel who want to run tests quickly.
Here are the available keyboard shortcuts and what each of them does:
Ctrl+Shift+F8
: Runs theartisan test create
command to create a new test file.Ctrl+Shift+F9
: Runs theartisan test
command on the current file if the file ends withTest.php
. Otherwise, it runs theartisan test --dirty
command.Ctrl+Shift+F11
: Runs theartisan test
command to run all tests.Ctrl+Shift+F10
: Runs theartisan test --filter
command and prompts the user to enter the filter tag for the test.
- Command:
artisanTest.runTest
- Description: Runs the
artisan test
command and allows the user to choose between the options:- All Files
- All Files With Parallel (
--parallel
) - Files Dirty (
--dirty
)
- Command:
artisanTest.runTestFile
- Description: Runs the
artisan test
command on the current file if the file ends withTest.php
.
- Command:
artisanTest.runTestFilter
- Description: Runs the
artisan test --filter
command and prompts the user to enter the filter tag for the test.
- Command:
artisanTest.runTestDirty
- Description: Runs the
artisan test --dirty
command.
- Command:
artisanTest.runTestCreate
- Description: Prompts the user to enter the test file name, select the test framework (Pest or PHPUnit), and select the test type (Feature or Unit). Creates a new test file using the selected options.
- Install the extension from the Visual Studio Code Marketplace.
- Open Visual Studio Code.
- Go to the Extensions view (
Ctrl+Shift+X
). - Search for "Artisan Test Shortcut" and install the extension.
- Open a Laravel project with PHP files in Visual Studio Code.
- Use the keyboard shortcuts mentioned above to run the Artisan Test commands.
Feel free to contribute with improvements or fixes. Fork the repository, create a branch for your changes, and submit a pull request.
For instructions on how to develop and test this extension, see DEVELOPMENT.md.
This extension is licensed under the MIT license. See the LICENSE file for more information.
Enjoy!