This makes it easy to run run tests as they get autoloaded as part of the modules package.
The Problem
Including the the tests dir as part of the autoload and not putting it in autoload-dev means that we cant make use of
composer dumpautoload --dev
and
composer dumpautoload --no-dev
Which is valuable when building a production image in order to keep tests out of production code as well as keeping the overall size (Mb) of the final built image as lean as possible.
Possible Solution
Since composer wont let you autoload the dev dependencies of packages in the vendor dir (or modules in our our case) we could instead do two things
Split out the autoloading in the modules composer.json to follow the normal conventions
Heya :wave: Thanks for your hard working maintaining this package :smile:
Context
The default behavior for creating a new module is to include the
tests
directory in theautoload
of the modulescomposer.json
file.This makes it easy to run run tests as they get autoloaded as part of the modules package.
The Problem
Including the the
tests
dir as part of theautoload
and not putting it inautoload-dev
means that we cant make use ofand
Which is valuable when building a production image in order to keep tests out of production code as well as keeping the overall size (Mb) of the final built image as lean as possible.
Possible Solution
Since composer wont let you autoload the dev dependencies of packages in the
vendor
dir (or modules in our our case) we could instead do two thingsmodules/order/composer.json
composer.json
file we add the tests dir to the autoload-dev section as wellcomposer.json
This would allow us to still easily run tests after creating a new module but also allow us to exclude test files from production build images.
Lemme know your thoughts and if its something your keen to implement I would be happy to submit a PR