Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove all tests in composer php?

I'm new in composer development. I just start to work with composer in my current project. And I think my question is already asked before or I'm noob about composer :D

There are many test files and directories in vendor of each dependency. I just want to remove those tests before upload it to server.

Is there any command to remove those tests OR I need to remove it manually OR what...? :'(

like image 879
Kannika Avatar asked Sep 09 '15 09:09

Kannika


1 Answers

Not directly, but if the package maintainers followed some best practises it is possible.

Use the --prefer-dist argument for composer install and composer update, then composer will try to download the packages' distributable instead of its source. For packages on GitHub this means, it downloads a zip file instead of cloning the repository.

It is possible that this still includes all the tests, but it is recommended to not include tests in the distributable. For packages on GitHub, tests are excluded if there is a .gitattributes file with content like:

/tests              export-ignore
/phpunit.xml        export-ignore

Read more: I don't need your tests in my production (Reddit)

like image 113
Fabian Schmengler Avatar answered Sep 17 '22 16:09

Fabian Schmengler