loading...

How to pass arguments to custom composer script

bravemaster619 profile image bravemaster619 ・1 min read

In my Laravel project, I want to run phpunit for a single file, like this one:

$ composer run-script test tests/Unit/Services/OrderServiceTest.php

Here is my composer setup:

"scripts": {
    "test": [
        "@testenv"
        "@phpunit"
    ],
    "testenv": [
        "php artisan config:cache --env=testing",
        "php artisan config:clear"
    ],
    "phpunit": [
        "php ./vendor/phpunit/phpunit/phpunit --"
    ]
}

Discussion

pic
Editor guide